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.
This commit is contained in:
Joseph Myers 2014-11-04 23:26:39 +00:00
parent 4243cbea6d
commit c5684fdb2b
20 changed files with 45 additions and 24 deletions

View File

@ -1,5 +1,27 @@
2014-11-04 Joseph Myers <joseph@codesourcery.com>
[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.

View File

@ -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)

View File

@ -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\

View File

@ -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\

View File

@ -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\

View File

@ -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. */ \

View File

@ -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\

View File

@ -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" \

View File

@ -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\

View File

@ -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\

View File

@ -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\

View File

@ -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; */

View File

@ -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

View File

@ -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\

View File

@ -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\

View File

@ -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\

View File

@ -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) \

View File

@ -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.

View File

@ -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\

View File

@ -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\