diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-10 23:35:19 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-11 02:36:22 +0100 |
commit | 3d3316b1dee885153d44210b2e95dba68d00613a (patch) | |
tree | 997c7734e51a76d2c11d0bfb5227f463c75df2e2 /sysdeps/mach | |
parent | a40b18b2330026cedc07348481bf3219f668adca (diff) | |
download | glibc-3d3316b1dee885153d44210b2e95dba68d00613a.zip glibc-3d3316b1dee885153d44210b2e95dba68d00613a.tar.gz glibc-3d3316b1dee885153d44210b2e95dba68d00613a.tar.bz2 |
hurd: keep only required PLTs in ld.so
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.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/_exit.c | 2 | ||||
-rw-r--r-- | sysdeps/mach/hurd/dl-sysdep.c | 4 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/ld.abilist | 1 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/localplt.data | 15 |
4 files changed, 5 insertions, 17 deletions
diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c index 46db06d..f04c5d2 100644 --- a/sysdeps/mach/hurd/_exit.c +++ b/sysdeps/mach/hurd/_exit.c @@ -51,5 +51,7 @@ _exit (int status) _hurd_exit (W_EXITCODE (status, 0)); } libc_hidden_def (_exit) +#ifndef NO_RTLD_HIDDEN rtld_hidden_def (_exit) +#endif weak_alias (_exit, _Exit) diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 5c0bb31..6b32d41 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -641,7 +641,8 @@ __sbrk (intptr_t increment) 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) { @@ -698,7 +699,6 @@ abort (void) /* 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) diff --git a/sysdeps/mach/hurd/i386/ld.abilist b/sysdeps/mach/hurd/i386/ld.abilist index 2e9bf28..0eaea9f 100644 --- a/sysdeps/mach/hurd/i386/ld.abilist +++ b/sysdeps/mach/hurd/i386/ld.abilist @@ -9,7 +9,6 @@ GLIBC_2.2.6 __open64 F 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 diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data index b199e14..abd8f31 100644 --- a/sysdeps/mach/hurd/i386/localplt.data +++ b/sysdeps/mach/hurd/i386/localplt.data @@ -37,24 +37,11 @@ ld.so: __access_noerrno 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 ? |