2002-12-08 Roland McGrath <roland@redhat.com>

* elf/Makefile (tests): Uncomment tst-array[123].
	* Makeconfig (CPPFLAGS-.oS): Add -DLIBC_NONSHARED=1.
	* csu/elf-init.c: New file.
	* csu/Makefile (routines, static-only-routines): Add elf-init.
	* sysdeps/alpha/elf/start.S: Use __libc_csu_init in place of _init
	and __libc_csu_fini in place of _fini.
	* sysdeps/arm/elf/start.S: Likewise.
	* sysdeps/cris/elf/start.S: Likewise.
	* sysdeps/hppa/elf/start.S: Likewise.
	* sysdeps/i386/elf/start.S: Likewise.
	* sysdeps/ia64/elf/start.S: Likewise.
	* sysdeps/m68k/elf/start.S: Likewise.
	* sysdeps/mach/hurd/powerpc/static-start.S: Likewise.
	* sysdeps/mips/elf/start.S: Likewise.
	* sysdeps/powerpc/powerpc32/elf/start.S: Likewise.
	* sysdeps/powerpc/powerpc64/elf/start.S: Likewise.
	* sysdeps/s390/s390-32/elf/start.S: Likewise.
	* sysdeps/s390/s390-64/elf/start.S: Likewise.
	* sysdeps/sh/elf/start.S: Likewise.
	* sysdeps/sparc/sparc32/elf/start.S: Likewise.
	* sysdeps/sparc/sparc64/elf/start.S: Likewise.
	* sysdeps/x86_64/elf/start.S: Likewise.
This commit is contained in:
Roland McGrath 2002-12-09 20:37:24 +00:00
parent 99c37bc7d8
commit f8a26bed6f
6 changed files with 42 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/* Startup code for Alpha/ELF. /* Startup code for Alpha/ELF.
Copyright (C) 1993,1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. Copyright (C) 1993,1995,1996,1997,1998,2000,2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu> Contributed by Richard Henderson <rth@tamu.edu>
@ -40,8 +40,8 @@ _start:
lda a2, 24(sp) /* get argv */ lda a2, 24(sp) /* get argv */
/* Load address of our own entry points to .fini and .init. */ /* Load address of our own entry points to .fini and .init. */
lda a3, _init lda a3, __libc_csu_init
lda a4, _fini lda a4, __libc_csu_fini
/* Store address of the shared library termination function. */ /* Store address of the shared library termination function. */
mov v0, a5 mov v0, a5

View File

@ -1,5 +1,5 @@
/* Startup code for ARM & ELF /* Startup code for ARM & ELF
Copyright (C) 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -54,12 +54,12 @@ _start:
/* Push the last arguments to main() onto the stack */ /* Push the last arguments to main() onto the stack */
stmfd sp!, {a1} stmfd sp!, {a1}
ldr a1, =_fini ldr a1, =__libc_csu_fini
stmfd sp!, {a1} stmfd sp!, {a1}
/* Set up the other arguments for main() that go in registers */ /* Set up the other arguments for main() that go in registers */
ldr a1, =main ldr a1, =main
ldr a4, =_init ldr a4, =__libc_csu_init
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */

View File

@ -1,5 +1,5 @@
/* Startup code compliant to the ELF CRIS ABI (to-be-written). /* Startup code compliant to the ELF CRIS ABI (to-be-written).
Copyright (C) 2001 Free Software Foundation, Inc. Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -89,15 +89,15 @@ _start:
move.d pc,r0 move.d pc,r0
sub.d .:GOTOFF,r0 sub.d .:GOTOFF,r0
move.d _init:PLTG,r13 move.d __libc_csu_init:PLTG,r13
add.d r0,r13 add.d r0,r13
move.d _fini:PLTG,r9 move.d __libc_csu_fini:PLTG,r9
add.d r0,r9 add.d r0,r9
move.d main:PLTG,r10 move.d main:PLTG,r10
add.d r0,r10 add.d r0,r10
#else #else
move.d _init,r13 move.d __libc_csu_init,r13
move.d _fini,r9 move.d __libc_csu_fini,r9
move.d main,r10 move.d main,r10
#endif #endif
push r9 push r9

View File

@ -1,3 +1,21 @@
/* ELF startup code for HPPA.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
.text .text
@ -6,11 +24,8 @@
.import main, code .import main, code
.import $global$, data .import $global$, data
.import __libc_start_main, code .import __libc_start_main, code
.import _fini, code .import __libc_csu_fini, code
.import _init, code .import __libc_csu_init, code
.globl _start .globl _start
.export _start, ENTRY .export _start, ENTRY
@ -33,12 +48,12 @@ _start:
stw %r23, -56(%sp) stw %r23, -56(%sp)
/* void (*init) (void) */ /* void (*init) (void) */
ldil LP%_init, %r23 ldil LP%__libc_csu_init, %r23
ldo RP%_init(%r23), %r23 ldo RP%__libc_csu_init(%r23), %r23
/* void (*fini) (void) */ /* void (*fini) (void) */
ldil LP%_fini, %r22 ldil LP%__libc_csu_fini, %r22
ldo RP%_fini(%r22), %r22 ldo RP%__libc_csu_fini(%r22), %r22
stw %r22, -52(%sp) stw %r22, -52(%sp)
/* void *stack_end */ /* void *stack_end */

View File

@ -1,5 +1,5 @@
/* Startup code compliant to the ELF m68k ABI. /* Startup code compliant to the ELF m68k ABI.
Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc. Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -60,8 +60,8 @@ _start:
/* Push the address of our own entry points to `.fini' and /* Push the address of our own entry points to `.fini' and
`.init'. */ `.init'. */
pea _fini pea __libc_csu_fini
pea _init pea __libc_csu_init
pea (%a0) /* Push second argument: argv. */ pea (%a0) /* Push second argument: argv. */
move.l %d0, -(%sp) /* Push first argument: argc. */ move.l %d0, -(%sp) /* Push first argument: argc. */

View File

@ -83,8 +83,8 @@ ENTRY_POINT:
the stack is aligned to double words (8 bytes). */ the stack is aligned to double words (8 bytes). */
and $29, 0xfffffff8 and $29, 0xfffffff8
subu $29, 32 subu $29, 32
la $7, _init /* init */ la $7, __libc_csu_init /* init */
la $8, _fini la $8, __libc_csu_fini
sw $8, 16($29) /* fini */ sw $8, 16($29) /* fini */
sw $2, 20($29) /* rtld_fini */ sw $2, 20($29) /* rtld_fini */
sw $29, 24($29) /* stack_end */ sw $29, 24($29) /* stack_end */