From c5684fdb2badfda3bd6e973e5f933272e39e9590 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 4 Nov 2014 23:26:39 +0000 Subject: [PATCH] Don't use INTDEF/INTUSE with _dl_init (bug 14132). Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this patch eliminates its use for _dl_init. Since _dl_init was already declared with hidden visibility, creating a second hidden alias for it was completely pointless, so this patch replaces all uses of _dl_init_internal with plain _dl_init instead of using hidden_proto / hidden_def (which are only needed when you want a hidden alias for a non-hidden symbol; it's quite possible there are cases where they are used but don't need to be because the symbol in question is not part of the public ABI and is only used within a single library, so using attributes_hidden instead would suffice). Tested for x86_64 that installed stripped shared libraries are unchanged by the patch. [BZ #14132] * elf/dl-init.c (_dl_init): Don't use INTDEF. * sysdeps/aarch64/dl-machine.h (RTLD_START): Use _dl_init instead of _dl_init_internal. * sysdeps/alpha/dl-machine.h (RTLD_START): Likewise. * sysdeps/arm/dl-machine.h (RTLD_START): Likewise. * sysdeps/hppa/dl-machine.h (RTLD_START): Likewise. * sysdeps/i386/dl-machine.h (RTLD_START): Likewise. * sysdeps/ia64/dl-machine.h (RTLD_START): Likewise. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * sysdeps/microblaze/dl-machine.h (RTLD_START): Likewise. * sysdeps/mips/dl-machine.h (RTLD_START): Likewise. * sysdeps/powerpc/powerpc32/dl-start.S (_start): Likewise. * sysdeps/s390/s390-32/dl-machine.h (RTLD_START): Likewise. * sysdeps/s390/s390-64/dl-machine.h (RTLD_START): Likewise. * sysdeps/sh/dl-machine.h (RTLD_START): Likewise. * sysdeps/sparc/sparc32/dl-machine.h (RTLD_START): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (RTLD_START): Likewise. * sysdeps/tile/dl-start.S (_start): Likewise. * sysdeps/x86_64/dl-machine.h (RTLD_START): Likewise. * sysdeps/x86_64/x32/dl-machine.h (RTLD_START): Likewise. --- ChangeLog | 22 ++++++++++++++++++++++ elf/dl-init.c | 1 - sysdeps/aarch64/dl-machine.h | 2 +- sysdeps/alpha/dl-machine.h | 2 +- sysdeps/arm/dl-machine.h | 2 +- sysdeps/hppa/dl-machine.h | 2 +- sysdeps/i386/dl-machine.h | 2 +- sysdeps/ia64/dl-machine.h | 2 +- sysdeps/m68k/dl-machine.h | 2 +- sysdeps/microblaze/dl-machine.h | 2 +- sysdeps/mips/dl-machine.h | 8 ++++---- sysdeps/powerpc/powerpc32/dl-start.S | 2 +- sysdeps/s390/s390-32/dl-machine.h | 2 +- sysdeps/s390/s390-64/dl-machine.h | 2 +- sysdeps/sh/dl-machine.h | 2 +- sysdeps/sparc/sparc32/dl-machine.h | 2 +- sysdeps/sparc/sparc64/dl-machine.h | 2 +- sysdeps/tile/dl-start.S | 2 +- sysdeps/x86_64/dl-machine.h | 4 ++-- sysdeps/x86_64/x32/dl-machine.h | 4 ++-- 20 files changed, 45 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3fa753b6823..21cf47f5529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2014-11-04 Joseph Myers + [BZ #14132] + * elf/dl-init.c (_dl_init): Don't use INTDEF. + * sysdeps/aarch64/dl-machine.h (RTLD_START): Use _dl_init instead + of _dl_init_internal. + * sysdeps/alpha/dl-machine.h (RTLD_START): Likewise. + * sysdeps/arm/dl-machine.h (RTLD_START): Likewise. + * sysdeps/hppa/dl-machine.h (RTLD_START): Likewise. + * sysdeps/i386/dl-machine.h (RTLD_START): Likewise. + * sysdeps/ia64/dl-machine.h (RTLD_START): Likewise. + * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. + * sysdeps/microblaze/dl-machine.h (RTLD_START): Likewise. + * sysdeps/mips/dl-machine.h (RTLD_START): Likewise. + * sysdeps/powerpc/powerpc32/dl-start.S (_start): Likewise. + * sysdeps/s390/s390-32/dl-machine.h (RTLD_START): Likewise. + * sysdeps/s390/s390-64/dl-machine.h (RTLD_START): Likewise. + * sysdeps/sh/dl-machine.h (RTLD_START): Likewise. + * sysdeps/sparc/sparc32/dl-machine.h (RTLD_START): Likewise. + * sysdeps/sparc/sparc64/dl-machine.h (RTLD_START): Likewise. + * sysdeps/tile/dl-start.S (_start): Likewise. + * sysdeps/x86_64/dl-machine.h (RTLD_START): Likewise. + * sysdeps/x86_64/x32/dl-machine.h (RTLD_START): Likewise. + [BZ #14132] * sysdeps/generic/ldsodefs.h (_dl_argv): Use rtld_hidden_proto. [IS_IN_rtld] (_dl_argv_internal): Do not declare. diff --git a/elf/dl-init.c b/elf/dl-init.c index 598df3b4aad..e5ade47acce 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -130,4 +130,3 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) INTUSE(_dl_starting_up) = 0; #endif } -INTDEF (_dl_init) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 6615b8f8575..674643781bb 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -178,7 +178,7 @@ _dl_start_user: \n\ adrp x16, _rtld_local \n\ add x16, x16, #:lo12:_rtld_local \n\ ldr x0, [x16] \n\ - bl _dl_init_internal \n\ + bl _dl_init \n\ // load the finalizer function \n\ adrp x0, _dl_fini \n\ add x0, x0, #:lo12:_dl_fini \n\ diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 64385ad68ab..b350b9ce4e7 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -173,7 +173,7 @@ $fixup_stack_ret: \n\ lda $18, 8($sp) \n\ s8addq $17, 8, $19 \n\ addq $19, $18, $19 \n\ - bsr $26, _dl_init_internal !samegp \n\ + bsr $26, _dl_init !samegp \n\ /* Pass our finalizer function to the user in $0. */ \n\ ldah $0, _dl_fini($gp) !gprelhigh \n\ lda $0, _dl_fini($0) !gprellow \n\ diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 31a92513ea6..33ea2f637e4 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -170,7 +170,7 @@ _dl_start_user:\n\ ldr r0, .L_LOADED\n\ ldr r0, [sl, r0]\n\ @ call _dl_init\n\ - bl _dl_init_internal(PLT)\n\ + bl _dl_init(PLT)\n\ @ load the finalizer function\n\ ldr r0, .L_FINI_PROC\n\ add r0, sl, r0\n\ diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index 9c7471e938a..9a9fe44c768 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -432,7 +432,7 @@ asm ( \ \ /* envp = argv + argc + 1 */ \ " sh2add %r25,%r24,%r23\n" \ -" bl _dl_init_internal,%r2\n" \ +" bl _dl_init,%r2\n" \ " ldo 4(%r23),%r23\n" /* delay slot */ \ \ /* Reload argc, argv to the registers start.S expects. */ \ diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index a3a632cda28..c10b1e56370 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -221,7 +221,7 @@ _dl_start_user:\n\ # Clear %ebp, so that even constructors have terminated backchain.\n\ xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ - call _dl_init_internal@PLT\n\ + call _dl_init@PLT\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ leal _dl_fini@GOTOFF(%ebx), %edx\n\ # Restore %esp _start expects.\n\ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 7d3be0487f0..39d918aaed6 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -271,7 +271,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " }\n" \ " { .mmb\n" \ " st8 [r2] = r17 /* Load the new _dl_argv. */\n" \ -" br.call.sptk.many b0 = _dl_init_internal#\n" \ +" br.call.sptk.many b0 = _dl_init#\n" \ " ;;\n" \ " }\n" \ " /* Pass our finalizer function to the user,\n" \ diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 4e7c7db846a..cc4bebb800a 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -149,7 +149,7 @@ _dl_start_user:\n\ pea 8(%sp)\n\ move.l %d1, -(%sp)\n\ " PCREL_OP ("move.l", "_rtld_local", "-(%sp)", "%d0", "%pc") "\n\ - jbsr _dl_init_internal@PLTPC\n\ + jbsr _dl_init@PLTPC\n\ addq.l #8, %sp\n\ addq.l #8, %sp\n\ | Pass our finalizer function to the user in %a1.\n\ diff --git a/sysdeps/microblaze/dl-machine.h b/sysdeps/microblaze/dl-machine.h index d230a1b4e3b..102c6bbd4f3 100644 --- a/sysdeps/microblaze/dl-machine.h +++ b/sysdeps/microblaze/dl-machine.h @@ -129,7 +129,7 @@ _dl_start_user:\n\ addk r8,r7,r5\n\ addik r8,r8,4\n\ lwi r5,r20,_rtld_local@GOTOFF\n\ - brlid r15,_dl_init_internal\n\ + brlid r15,_dl_init\n\ nop\n\ lwi r5,r1,24\n\ lwi r3,r1,20\n\ diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index eef0384e4e0..5000d2a300b 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -295,14 +295,14 @@ do { \ sll $7, $5, " STRINGXP (PTRLOG) "\n\ " STRINGXP(PTR_ADDU) " $7, $7, $6\n\ " STRINGXP(PTR_ADDU) " $7, $7, " STRINGXP (PTRSIZE) " \n\ - # Make sure the stack pointer is aligned for _dl_init_internal.\n\ + # Make sure the stack pointer is aligned for _dl_init.\n\ and $2, $29, -2 * " STRINGXP(SZREG) "\n\ move $8, $29\n\ " STRINGXP(PTR_SUBIU) " $29, $2, 32\n\ " STRINGXP(PTR_S) " $8, (32 - " STRINGXP(SZREG) ")($29)\n\ " STRINGXP(SAVE_GP(16)) "\n\ # Call the function to run the initializers.\n\ - jal _dl_init_internal\n\ + jal _dl_init\n\ # Restore the stack pointer for _start.\n\ " STRINGXP(PTR_L) " $29, (32 - " STRINGXP(SZREG) ")($29)\n\ # Pass our finalizer function to the user in $2 as per ELF ABI.\n\ @@ -371,7 +371,7 @@ do { \ sll $7, $5, " STRINGXP (PTRLOG) "\n\ addu $7, $6\n\ addu $7, " STRINGXP (PTRSIZE) "\n\ - # Make sure the stack pointer is aligned for _dl_init_internal.\n\ + # Make sure the stack pointer is aligned for _dl_init.\n\ li $2, 2 * " STRINGXP (SZREG) "\n\ neg $2, $2\n\ move $3, $sp\n\ @@ -381,7 +381,7 @@ do { \ move $sp, $2\n\ sw $16, 16($sp)\n\ # Call the function to run the initializers.\n\ - lw $2, %call16(_dl_init_internal)($16)\n\ + lw $2, %call16(_dl_init)($16)\n\ move $25, $2\n\ jalr $2\n\ # Restore the stack pointer for _start.\n\ diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S index be8ce441ac9..d54cd70f444 100644 --- a/sysdeps/powerpc/powerpc32/dl-start.S +++ b/sysdeps/powerpc/powerpc32/dl-start.S @@ -63,7 +63,7 @@ _dl_start_user: slwi r6,r4,2 add r6,r5,r6 addi r6,r6,4 - bl _dl_init_internal@local + bl _dl_init@local /* Now, to conform to the ELF ABI, we have to: */ /* Pass argc (actually _dl_argc) in r3; */ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 527233ba548..c56185c538d 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -203,7 +203,7 @@ _dl_start_user:\n\ .Llit:\n\ .Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\ .Ladr1: .long _dl_start-.Llit\n\ -.Ladr4: .long _dl_init_internal@PLT-.Llit\n\ +.Ladr4: .long _dl_init@PLT-.Llit\n\ "); #ifndef RTLD_START_SPECIAL_INIT diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index e48d355daac..463021c6a45 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -175,7 +175,7 @@ _dl_start_user:\n\ lgr %r5,%r3\n\ sllg %r5,%r5,3\n\ la %r5,176(%r5,%r15)\n\ - brasl %r14,_dl_init_internal@PLT\n\ + brasl %r14,_dl_init@PLT\n\ # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ lghi %r14,_dl_fini@GOT\n\ lg %r14,0(%r14,%r12)\n\ diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 81a417d9aaa..daac99d2987 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -188,7 +188,7 @@ _dl_start_user:\n\ .L_dl_skip_args:\n\ .long _dl_skip_args@GOT\n\ .L_dl_init:\n\ - .long _dl_init_internal@PLT\n\ + .long _dl_init@PLT\n\ .L_dl_loaded:\n\ .long _rtld_local@GOT\n\ .L_dl_fini:\n\ diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 4b79cd69fc3..a24d5727b98 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -282,7 +282,7 @@ _dl_start_user:\n\ add %o3, 4, %o3\n\ mov %i5, %o1\n\ add %o2, %o3, %o3\n\ - call _dl_init_internal\n\ + call _dl_init\n\ ld [%o0], %o0\n\ /* Pass our finalizer function to the user in %g1. */\n\ " RTLD_GOT_ADDRESS(%l7, %g1, _dl_fini) "\n\ diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index d6d263e96c8..c9ee83520ce 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -333,7 +333,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " add %o3, 8, %o3\n" \ " mov %i5, %o1\n" \ " add %o2, %o3, %o3\n" \ -" call _dl_init_internal\n" \ +" call _dl_init\n" \ " ldx [%o0], %o0\n" \ " /* Pass our finalizer function to the user in %g1. */\n" \ RTLD_GOT_ADDRESS(%l7, %g1, _dl_fini) \ diff --git a/sysdeps/tile/dl-start.S b/sysdeps/tile/dl-start.S index d13f6096dc6..5a8876e49af 100644 --- a/sysdeps/tile/dl-start.S +++ b/sysdeps/tile/dl-start.S @@ -94,7 +94,7 @@ ENTRY (_start) } { SHL_PTR_ADD r3, r3, r2 /* point r3 at envp */ - jal _dl_init_internal + jal _dl_init } /* Call user program whose address we saved in r50. diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index f9ee1f79b65..8316f13a06b 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -145,7 +145,7 @@ _dl_start_user:\n\ movq %rdx, %rsi\n\ # Save %rsp value in %r13.\n\ movq %rsp, %r13\n\ - # And align stack for the _dl_init_internal call. \n\ + # And align stack for the _dl_init call. \n\ andq $-16, %rsp\n\ # _dl_loaded -> rdi\n\ movq _rtld_local(%rip), %rdi\n\ @@ -156,7 +156,7 @@ _dl_start_user:\n\ # Clear %rbp to mark outermost frame obviously even for constructors.\n\ xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ - call _dl_init_internal@PLT\n\ + call _dl_init@PLT\n\ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ leaq _dl_fini(%rip), %rdx\n\ # And make sure %rsp points to argc stored on the stack.\n\ diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h index 3ee41cf4a40..433435e870a 100644 --- a/sysdeps/x86_64/x32/dl-machine.h +++ b/sysdeps/x86_64/x32/dl-machine.h @@ -62,7 +62,7 @@ _dl_start_user:\n\ movl %edx, %esi\n\ # Save %rsp value in %r13.\n\ movl %esp, %r13d\n\ - # And align stack for the _dl_init_internal call.\n\ + # And align stack for the _dl_init call.\n\ and $-16, %esp\n\ # _dl_loaded -> rdi\n\ movl _rtld_local(%rip), %edi\n\ @@ -73,7 +73,7 @@ _dl_start_user:\n\ # Clear %rbp to mark outermost frame obviously even for constructors.\n\ xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ - call _dl_init_internal\n\ + call _dl_init\n\ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ lea _dl_fini(%rip), %edx\n\ # And make sure %rsp points to argc stored on the stack.\n\ -- 2.39.5