We need NO_RTLD_HIDDEN because of the need for PLT calls in ld.so.
See Roland's comment in
https://sourceware.org/bugzilla/show_bug.cgi?id=15605
"in the Hurd it's crucial that calls like __mmap be the libc ones
instead of the rtld-local ones after the bootstrap phase, when the
dynamic linker is being used for dlopen and the like."
We used to just avoid all hidden use in the rtld ; this commit switches to
keeping only those that should use PLT calls, i.e. essentially those defined in
sysdeps/mach/hurd/dl-sysdep.c:
__assert_fail
__assert_perror_fail
__*stat64
_exit
This fixes a few startup issues, notably the call to __tunable_get_val that is
made before PLTs are set up.
assertion);
}
+# ifndef NO_RTLD_HIDDEN
rtld_hidden_weak (__assert_fail)
+# endif
void weak_function
__assert_perror_fail (int errnum,
__strerror_r (errnum, errbuf, sizeof errbuf));
}
+# ifndef NO_RTLD_HIDDEN
rtld_hidden_weak (__assert_perror_fail)
+# endif
#endif
\f
#undef _itoa
libc_hidden_proto (__rewinddir)
extern __typeof (scandirat) __scandirat;
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (__rewinddir) __rewinddir attribute_hidden;
# endif
# endif
/* Define and initialize `__progname' et. al. */
extern void __init_misc (int, char **, char **) attribute_hidden;
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (__profile_frequency) __profile_frequency attribute_hidden;
# endif
# define libc_hidden_data_ver(local, name)
#endif
-#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+#if IS_IN (rtld)
# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define rtld_hidden_def(name) hidden_def (name)
libc_hidden_proto (_setjmp)
libc_hidden_proto (__sigsetjmp)
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (__sigsetjmp) __sigsetjmp attribute_hidden;
# endif
/* Allocate real-time signal with highest/lowest available priority. */
extern int __libc_allocate_rtsig (int __high);
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (__sigaction) __sigaction attribute_hidden;
extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
# endif
extern struct abort_msg_s *__abort_msg;
libc_hidden_proto (__abort_msg)
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (unsetenv) unsetenv attribute_hidden;
extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
# endif
libc_hidden_builtin_proto (strstr)
libc_hidden_builtin_proto (ffs)
-#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+#if IS_IN (rtld)
extern __typeof (__stpcpy) __stpcpy attribute_hidden;
extern __typeof (__strdup) __strdup attribute_hidden;
extern __typeof (__strerror_r) __strerror_r attribute_hidden;
libc_hidden_proto (uname)
libc_hidden_proto (__uname)
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (__uname) __uname attribute_hidden;
# endif
#endif
# ifndef _ISOMAC
libc_hidden_proto (_exit, __noreturn__)
+# ifndef NO_RTLD_HIDDEN
rtld_hidden_proto (_exit, __noreturn__)
+# endif
libc_hidden_proto (alarm)
extern size_t __confstr (int name, char *buf, size_t len);
libc_hidden_proto (__confstr)
extern const char _itoa_upper_digits[];
extern const char _itoa_lower_digits[];
-#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
+#if IS_IN (libc) || IS_IN (rtld)
hidden_proto (_itoa_upper_digits)
hidden_proto (_itoa_lower_digits)
#endif
.p2align 4,,7
.Lslow:
cfi_adjust_cfa_offset (28)
-#ifdef NO_RTLD_HIDDEN
- call JUMPTARGET (___tls_get_addr)
-#else
call HIDDEN_JUMPTARGET (___tls_get_addr)
-#endif
jmp .Lret
cfi_endproc
.size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic
_hurd_exit (W_EXITCODE (status, 0));
}
libc_hidden_def (_exit)
+#ifndef NO_RTLD_HIDDEN
rtld_hidden_def (_exit)
+#endif
weak_alias (_exit, _Exit)
return (void *) addr;
}
-check_no_hidden(__strtoul_internal);
+/* This is only used by hurdlookup for the /dev/fd/nnn magic.
+ * We avoid pulling the whole libc implementation, and we can keep this hidden. */
unsigned long int weak_function
__strtoul_internal (const char *nptr, char **endptr, int base, int group)
{
/* We need this alias to satisfy references from libc_pic.a objects
that were affected by the libc_hidden_proto declaration for abort. */
strong_alias (abort, __GI_abort)
-strong_alias (abort, __GI___chk_fail)
strong_alias (abort, __GI___fortify_fail)
strong_alias (abort, __GI___assert_fail)
strong_alias (abort, __GI___assert_perror_fail)
GLIBC_2.2.6 __pread64 F
GLIBC_2.2.6 __read F
GLIBC_2.2.6 __sbrk F
-GLIBC_2.2.6 __strtoul_internal F
GLIBC_2.2.6 __write F
GLIBC_2.2.6 __writev F
GLIBC_2.2.6 __xstat64 F
ld.so: __getpid
ld.so: __getcwd
ld.so: __sbrk
-ld.so: __strtoul_internal
-#ld.so: _exit
+ld.so: _exit ?
ld.so: abort
ld.so: _hurd_intr_rpc_mach_msg
ld.so: __errno_location
-# rtld_hidden is currently disabled to avoid having to special-case the
-# functions above which do need a PLT. These are thus currently expected.
-ld.so: _dl_allocate_tls
-ld.so: _dl_allocate_tls_init
-ld.so: _dl_exception_create
-ld.so: _dl_exception_create_format
-ld.so: _dl_exception_free
-ld.so: _dl_fatal_printf
-ld.so: _dl_find_dso_for_object
ld.so: _dl_init_first
-ld.so: _dl_mcount
-ld.so: ___tls_get_addr
-ld.so: __tunable_get_val
#
# These should ideally be avoided, but is currently difficult
libc.so: siglongjmp ?
movq %r10, 40(%rsp)
movq %r11, 48(%rsp)
/* %rdi already points to the tlsinfo data structure. */
-#ifdef NO_RTLD_HIDDEN
- call JUMPTARGET (__tls_get_addr)
-#else
call HIDDEN_JUMPTARGET (__tls_get_addr)
-#endif
movq 8(%rsp), %rdx
movq 16(%rsp), %rcx
movq 24(%rsp), %r8