From 9cf27b8d09aab26bd4693b10f281d64da779da83 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 5 Nov 2014 23:35:36 +0000 Subject: Remove INTDEF / INTUSE / INTVARDEF (bug 14132). Completing the removal of the obsolete INTDEF / INTUSE mechanism, this patch removes the final use - that for _dl_starting_up - replacing it by rtld_hidden_def / rtld_hidden_proto. Having removed the last use, the mechanism itself is also removed. Tested for x86_64 that installed stripped shared libraries are unchanged by the patch. (This is not much of a test since this variable is only defined and used in the !HAVE_INLINED_SYSCALLS case.) [BZ #14132] * include/libc-symbols.h (INTUSE): Remove macro. (INTDEF): Likewise. (INTVARDEF): Likewise. (_INTVARDEF): Likewise. (INTDEF2): Likewise. (INTVARDEF2): Likewise. * elf/rtld.c [!HAVE_INLINED_SYSCALLS] (_dl_starting_up): Use rtld_hidden_def instead of INTVARDEF. * sysdeps/generic/ldsodefs.h [IS_IN_rtld] (_dl_starting_up_internal): Remove declaration. (_dl_starting_up): Use rtld_hidden_proto. * elf/dl-init.c [!HAVE_INLINED_SYSCALLS] (_dl_starting_up): Remove declaration. [!HAVE_INLINED_SYSCALLS] (_dl_starting_up_internal): Likewise. (_dl_init) [!HAVE_INLINED_SYSCALLS]: Don't use INTUSE with _dl_starting_up. * elf/dl-writev.h (_dl_writev): Likewise. * sysdeps/powerpc/powerpc64/dl-machine.h [!HAVE_INLINED_SYSCALLS] (DL_STARTING_UP_DEF): Use __GI__dl_starting_up instead of _dl_starting_up_internal. --- ChangeLog | 24 ++++++++++++++++++++++++ NEWS | 4 ++-- elf/dl-init.c | 8 +------- elf/dl-writev.h | 2 +- elf/rtld.c | 4 ++-- include/libc-symbols.h | 20 -------------------- sysdeps/generic/ldsodefs.h | 4 +--- sysdeps/powerpc/powerpc64/dl-machine.h | 2 +- 8 files changed, 32 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index e402f0d..9ee1c0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2014-11-05 Joseph Myers + + [BZ #14132] + * include/libc-symbols.h (INTUSE): Remove macro. + (INTDEF): Likewise. + (INTVARDEF): Likewise. + (_INTVARDEF): Likewise. + (INTDEF2): Likewise. + (INTVARDEF2): Likewise. + * elf/rtld.c [!HAVE_INLINED_SYSCALLS] (_dl_starting_up): Use + rtld_hidden_def instead of INTVARDEF. + * sysdeps/generic/ldsodefs.h [IS_IN_rtld] + (_dl_starting_up_internal): Remove declaration. + (_dl_starting_up): Use rtld_hidden_proto. + * elf/dl-init.c [!HAVE_INLINED_SYSCALLS] (_dl_starting_up): Remove + declaration. + [!HAVE_INLINED_SYSCALLS] (_dl_starting_up_internal): Likewise. + (_dl_init) [!HAVE_INLINED_SYSCALLS]: Don't use INTUSE with + _dl_starting_up. + * elf/dl-writev.h (_dl_writev): Likewise. + * sysdeps/powerpc/powerpc64/dl-machine.h [!HAVE_INLINED_SYSCALLS] + (DL_STARTING_UP_DEF): Use __GI__dl_starting_up instead of + _dl_starting_up_internal. + 2014-11-05 Adhemerval Zanella * stdio-common/tst-fmemopen.c (do_test): Refactor to use diff --git a/NEWS b/NEWS index 4656531..8c3302c 100644 --- a/NEWS +++ b/NEWS @@ -9,8 +9,8 @@ Version 2.21 * The following bugs are resolved with this release: - 6652, 12926, 14138, 14171, 15215, 15884, 17266, 17344, 17363, 17370, - 17371, 17411, 17460, 17485, 17501, 17508, 17522. + 6652, 12926, 14132, 14138, 14171, 15215, 15884, 17266, 17344, 17363, + 17370, 17371, 17411, 17460, 17485, 17501, 17508, 17522. Version 2.20 diff --git a/elf/dl-init.c b/elf/dl-init.c index e5ade47..c80ec64 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -23,12 +23,6 @@ /* Type of the initializer. */ typedef void (*init_t) (int, char **, char **); -#ifndef HAVE_INLINED_SYSCALLS -/* Flag, nonzero during startup phase. */ -extern int _dl_starting_up; -extern int _dl_starting_up_internal attribute_hidden; -#endif - static void call_init (struct link_map *l, int argc, char **argv, char **env) @@ -127,6 +121,6 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) #ifndef HAVE_INLINED_SYSCALLS /* Finished starting up. */ - INTUSE(_dl_starting_up) = 0; + _dl_starting_up = 0; #endif } diff --git a/elf/dl-writev.h b/elf/dl-writev.h index a5ce6c5..6eace99 100644 --- a/elf/dl-writev.h +++ b/elf/dl-writev.h @@ -42,7 +42,7 @@ _dl_writev (int fd, const struct iovec *iov, size_t niov) errno when it's being used by another thread that cares about it. Yet we must be sure not to try calling the lock functions before the thread library is fully initialized. */ - if (__glibc_unlikely (INTUSE (_dl_starting_up))) + if (__glibc_unlikely (_dl_starting_up)) __writev (fd, iov, niov); else { diff --git a/elf/rtld.c b/elf/rtld.c index b07ff43..76c57f0 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -116,7 +116,7 @@ static struct audit_list and will be since that dynamic linker's _dl_start and dl_main will never be called. */ int _dl_starting_up = 0; -INTVARDEF(_dl_starting_up) +rtld_hidden_def (_dl_starting_up) #endif /* This is the structure which defines all variables global to ld.so @@ -778,7 +778,7 @@ dl_main (const ElfW(Phdr) *phdr, #ifndef HAVE_INLINED_SYSCALLS /* Set up a flag which tells we are just starting. */ - INTUSE(_dl_starting_up) = 1; + _dl_starting_up = 1; #endif if (*user_entry == (ElfW(Addr)) ENTRY_POINT) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index d4ab1f3..b1ac9db 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -391,26 +391,6 @@ for linking") #define attribute_relro __attribute__ ((section (".data.rel.ro"))) -/* Handling on non-exported internal names. We have to do this only - for shared code. */ -#ifdef SHARED -# define INTUSE(name) name##_internal -# define INTDEF(name) strong_alias (name, name##_internal) -# define INTVARDEF(name) \ - _INTVARDEF (name, name##_internal) -# define _INTVARDEF(name, aliasname) \ - extern __typeof (name) aliasname __attribute__ ((alias (#name), \ - visibility ("hidden"))); -# define INTDEF2(name, newname) strong_alias (name, newname##_internal) -# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) -#else -# define INTUSE(name) name -# define INTDEF(name) -# define INTVARDEF(name) -# define INTDEF2(name, newname) -# define INTVARDEF2(name, newname) -#endif - /* The following macros are used for PLT bypassing within libc.so (and if needed other libraries similarly). First of all, you need to have the function prototyped somewhere, diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index f339ee3..b91a973 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -659,9 +659,7 @@ extern unsigned int _dl_skip_args_internal attribute_hidden /* Flag set at startup and cleared when the last initializer has run. */ extern int _dl_starting_up; weak_extern (_dl_starting_up) -#ifdef IS_IN_rtld -extern int _dl_starting_up_internal attribute_hidden; -#endif +rtld_hidden_proto (_dl_starting_up) /* Random data provided by the kernel. */ extern void *_dl_random attribute_hidden attribute_relro; diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 3007e80..8811d5d 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -126,7 +126,7 @@ elf_machine_dynamic (void) #else # define DL_STARTING_UP_DEF \ ".LC__dl_starting_up:\n" \ -" .tc _dl_starting_up_internal[TC],_dl_starting_up_internal\n" +" .tc __GI__dl_starting_up[TC],__GI__dl_starting_up\n" #endif -- cgit v1.1