mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* 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:
23
ChangeLog
23
ChangeLog
@ -1,5 +1,28 @@
|
|||||||
2002-12-08 Roland McGrath <roland@redhat.com>
|
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.
|
||||||
|
|
||||||
* sysdeps/pthread/aio_notify.c (notify_func_wrapper): Take a malloc'd
|
* sysdeps/pthread/aio_notify.c (notify_func_wrapper): Take a malloc'd
|
||||||
struct containing function ptr and value, free it.
|
struct containing function ptr and value, free it.
|
||||||
(__aio_notify_only): Allocate that and copy values from SIGEV into it.
|
(__aio_notify_only): Allocate that and copy values from SIGEV into it.
|
||||||
|
@ -711,7 +711,7 @@ object-suffixes-for-libc += .oS
|
|||||||
# shared objects. We don't want to use CFLAGS-os because users may, for
|
# shared objects. We don't want to use CFLAGS-os because users may, for
|
||||||
# example, make that processor-specific.
|
# example, make that processor-specific.
|
||||||
CFLAGS-.oS = $(CFLAGS-.o) $(pic-ccflag)
|
CFLAGS-.oS = $(CFLAGS-.o) $(pic-ccflag)
|
||||||
CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC
|
CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
|
||||||
libtype.oS = lib%_nonshared.a
|
libtype.oS = lib%_nonshared.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -27,9 +27,10 @@
|
|||||||
subdir := csu
|
subdir := csu
|
||||||
|
|
||||||
routines = init-first libc-start $(libc-init) sysdep version check_fds \
|
routines = init-first libc-start $(libc-init) sysdep version check_fds \
|
||||||
libc-tls
|
libc-tls elf-init
|
||||||
aux = errno
|
aux = errno
|
||||||
elide-routines.os = libc-tls
|
elide-routines.os = libc-tls
|
||||||
|
static-only-routines = elf-init
|
||||||
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
|
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
|
||||||
extra-objs = start.o gmon-start.o \
|
extra-objs = start.o gmon-start.o \
|
||||||
$(start-installed-name) g$(start-installed-name) $(csu-dummies)
|
$(start-installed-name) g$(start-installed-name) $(csu-dummies)
|
||||||
|
82
csu/elf-init.c
Normal file
82
csu/elf-init.c
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/* Startup support for ELF initializers/finalizers in the main executable.
|
||||||
|
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. */
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_INITFINI_ARRAY
|
||||||
|
/* These magic symbols are provided by the linker. */
|
||||||
|
extern void (*__preinit_array_start []) (void);
|
||||||
|
extern void (*__preinit_array_end []) (void);
|
||||||
|
extern void (*__init_array_start []) (void);
|
||||||
|
extern void (*__init_array_end []) (void);
|
||||||
|
extern void (*__fini_array_start []) (void);
|
||||||
|
extern void (*__fini_array_end []) (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These function symbols are provided for the .init/.fini section entry
|
||||||
|
points automagically by the linker. */
|
||||||
|
extern void _init (void);
|
||||||
|
extern void _fini (void);
|
||||||
|
|
||||||
|
/* These functions are passed to __libc_start_main by the startup code.
|
||||||
|
These get statically linked into each program. For dynamically linked
|
||||||
|
programs, this module will come from libc_nonshared.a and differs from
|
||||||
|
the libc.a module in that it doesn't call the preinit array. */
|
||||||
|
|
||||||
|
void
|
||||||
|
__libc_csu_init (void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_INITFINI_ARRAY
|
||||||
|
/* For dynamically linked executables the preinit array is executed by
|
||||||
|
the dynamic linker (before initializing any shared object. */
|
||||||
|
|
||||||
|
# ifndef LIBC_NONSHARED
|
||||||
|
/* For static executables, preinit happens rights before init. */
|
||||||
|
{
|
||||||
|
const size_t size = __preinit_array_end - __preinit_array_start;
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
(*__preinit_array_start [i]) ();
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_init ();
|
||||||
|
|
||||||
|
#ifdef HAVE_INITFINI_ARRAY
|
||||||
|
{
|
||||||
|
const size_t size = __init_array_end - __init_array_start;
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
(*__init_array_start [i]) ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__libc_csu_fini (void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_INITFINI_ARRAY
|
||||||
|
size_t i = __fini_array_end - __fini_array_start;
|
||||||
|
while (i-- > 0)
|
||||||
|
(*__fini_array_start [i]) ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_fini ();
|
||||||
|
}
|
@ -118,7 +118,7 @@ endif
|
|||||||
|
|
||||||
tests = tst-tls1 tst-tls2 tst-tls9
|
tests = tst-tls1 tst-tls2 tst-tls9
|
||||||
ifeq (yes,$(have-initfini-array))
|
ifeq (yes,$(have-initfini-array))
|
||||||
#tests += tst-array1 tst-array2 tst-array3
|
tests += tst-array1 tst-array2 tst-array3
|
||||||
endif
|
endif
|
||||||
ifeq (yes,$(build-static))
|
ifeq (yes,$(build-static))
|
||||||
tests-static = tst-tls1-static tst-tls2-static
|
tests-static = tst-tls1-static tst-tls2-static
|
||||||
|
@ -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
|
||||||
|
@ -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) */
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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,12 +24,9 @@
|
|||||||
.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
|
||||||
.type _start,@function
|
.type _start,@function
|
||||||
@ -28,17 +43,17 @@ _start:
|
|||||||
|
|
||||||
/* Expand the stack to store the 5th through 7th args */
|
/* Expand the stack to store the 5th through 7th args */
|
||||||
ldo 64(%sp), %sp
|
ldo 64(%sp), %sp
|
||||||
|
|
||||||
/* void (*rtld_fini) (void) (actually the 6th arg) */
|
/* void (*rtld_fini) (void) (actually the 6th arg) */
|
||||||
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 */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code compliant to the ELF i386 ABI.
|
/* Startup code compliant to the ELF i386 ABI.
|
||||||
Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
|
Copyright (C) 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.
|
||||||
|
|
||||||
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
|
||||||
@ -68,8 +68,8 @@ _start:
|
|||||||
termination function. */
|
termination function. */
|
||||||
|
|
||||||
/* Push address of our own entry points to .fini and .init. */
|
/* Push address of our own entry points to .fini and .init. */
|
||||||
pushl $_fini
|
pushl $__libc_csu_fini
|
||||||
pushl $_init
|
pushl $__libc_csu_init
|
||||||
|
|
||||||
pushl %ecx /* Push second argument: argv. */
|
pushl %ecx /* Push second argument: argv. */
|
||||||
pushl %esi /* Push first argument: argc. */
|
pushl %esi /* Push first argument: argc. */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
/* Copyright (C) 1999, 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.
|
||||||
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
|
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
|
||||||
|
|
||||||
@ -64,13 +64,13 @@ _start:
|
|||||||
{
|
{
|
||||||
addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
|
addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
|
||||||
addl out0 = @ltoff(@fptr(main)), gp
|
addl out0 = @ltoff(@fptr(main)), gp
|
||||||
addl out3 = @ltoff(@fptr(_init)), gp
|
addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
|
||||||
;;
|
;;
|
||||||
}
|
}
|
||||||
{ .mmi
|
{ .mmi
|
||||||
ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
|
ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
|
||||||
ld8 out0 = [out0] /* pointer to `main' function descriptor */
|
ld8 out0 = [out0] /* pointer to `main' function descriptor */
|
||||||
addl out4 = @ltoff(@fptr(_fini)), gp
|
addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
|
||||||
;;
|
;;
|
||||||
}
|
}
|
||||||
{ .mmi
|
{ .mmi
|
||||||
|
@ -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. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code for statically linked Hurd/PowerPC binaries.
|
/* Startup code for statically linked Hurd/PowerPC binaries.
|
||||||
Copyright (C) 1998,2001 Free Software Foundation, Inc.
|
Copyright (C) 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
|
||||||
@ -22,13 +22,13 @@
|
|||||||
/* These are the various addresses we require. */
|
/* These are the various addresses we require. */
|
||||||
.section ".rodata"
|
.section ".rodata"
|
||||||
.align 2
|
.align 2
|
||||||
weak_extern(_init)
|
weak_extern(__libc_csu_init)
|
||||||
weak_extern(_fini)
|
weak_extern(__libc_csu_fini)
|
||||||
L(start_addresses):
|
L(start_addresses):
|
||||||
.long _SDA_BASE_
|
.long _SDA_BASE_
|
||||||
.long JUMPTARGET(main)
|
.long JUMPTARGET(main)
|
||||||
.long JUMPTARGET(_init)
|
.long JUMPTARGET(__libc_csu_init)
|
||||||
.long JUMPTARGET(_fini)
|
.long JUMPTARGET(__libc_csu_fini)
|
||||||
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
||||||
|
|
||||||
.section ".text"
|
.section ".text"
|
||||||
|
@ -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 */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code for programs linked with GNU libc.
|
/* Startup code for programs linked with GNU libc.
|
||||||
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999, 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.
|
||||||
|
|
||||||
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
|
||||||
@ -23,13 +23,11 @@
|
|||||||
/* These are the various addresses we require. */
|
/* These are the various addresses we require. */
|
||||||
.section ".rodata"
|
.section ".rodata"
|
||||||
.align 2
|
.align 2
|
||||||
weak_extern(_init)
|
|
||||||
weak_extern(_fini)
|
|
||||||
L(start_addresses):
|
L(start_addresses):
|
||||||
.long _SDA_BASE_
|
.long _SDA_BASE_
|
||||||
.long JUMPTARGET(BP_SYM (main))
|
.long JUMPTARGET(BP_SYM (main))
|
||||||
.long JUMPTARGET(_init)
|
.long JUMPTARGET(__libc_csu_init)
|
||||||
.long JUMPTARGET(_fini)
|
.long JUMPTARGET(__libc_csu_fini)
|
||||||
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
||||||
|
|
||||||
.section ".text"
|
.section ".text"
|
||||||
|
@ -23,16 +23,12 @@
|
|||||||
/* These are the various addresses we require. */
|
/* These are the various addresses we require. */
|
||||||
.section ".rodata"
|
.section ".rodata"
|
||||||
.align 3
|
.align 3
|
||||||
weak_extern(_init)
|
|
||||||
weak_extern(_fini)
|
|
||||||
weak_extern(._init)
|
|
||||||
weak_extern(._fini)
|
|
||||||
L(start_addresses):
|
L(start_addresses):
|
||||||
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
|
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
|
||||||
/* function descriptors so don't need JUMPTARGET */
|
/* function descriptors so don't need JUMPTARGET */
|
||||||
.quad BP_SYM(main)
|
.quad BP_SYM(main)
|
||||||
.quad _init
|
.quad __libc_csu_init
|
||||||
.quad _fini
|
.quad __libc_csu_fini
|
||||||
|
|
||||||
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
||||||
|
|
||||||
@ -55,7 +51,7 @@ ENTRY(_start)
|
|||||||
ld r8,.L01(r2)
|
ld r8,.L01(r2)
|
||||||
|
|
||||||
/* and continue in libc-start, in glibc. */
|
/* and continue in libc-start, in glibc. */
|
||||||
b JUMPTARGET(BP_SYM(__libc_start_main))
|
b JUMPTARGET(BP_SYM(__libc_start_main))
|
||||||
|
|
||||||
END(_start)
|
END(_start)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code compliant to the ELF s390 ABI.
|
/* Startup code compliant to the ELF s390 ABI.
|
||||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
@ -63,8 +63,8 @@ _start:
|
|||||||
*/
|
*/
|
||||||
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
|
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
|
||||||
la %r7,96(%r15)
|
la %r7,96(%r15)
|
||||||
l %r6,.L2-.Llit(%r13) # load pointer to _fini
|
l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini
|
||||||
l %r5,.L1-.Llit(%r13) # load pointer to _init
|
l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init
|
||||||
l %r2,.L3-.Llit(%r13) # load pointer to main
|
l %r2,.L3-.Llit(%r13) # load pointer to main
|
||||||
|
|
||||||
/* ok, now branch to the libc main routine */
|
/* ok, now branch to the libc main routine */
|
||||||
@ -75,8 +75,8 @@ _start:
|
|||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
.Llit:
|
.Llit:
|
||||||
.L1: .long _init
|
.L1: .long __libc_csu_init
|
||||||
.L2: .long _fini
|
.L2: .long __libc_csu_fini
|
||||||
.L3: .long main
|
.L3: .long main
|
||||||
.L4: .long __libc_start_main
|
.L4: .long __libc_start_main
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code compliant to the 64 bit S/390 ELF ABI.
|
/* Startup code compliant to the 64 bit S/390 ELF ABI.
|
||||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||||
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ _start:
|
|||||||
*/
|
*/
|
||||||
stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
|
stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
|
||||||
la %r7,160(%r15)
|
la %r7,160(%r15)
|
||||||
larl %r6,_fini # load pointer to _fini
|
larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini
|
||||||
larl %r5,_init # load pointer to _init
|
larl %r5,__libc_csu_init # load pointer to __libc_csu_init
|
||||||
larl %r2,main # load pointer to main
|
larl %r2,main # load pointer to main
|
||||||
|
|
||||||
/* Ok, now branch to the libc main routine. */
|
/* Ok, now branch to the libc main routine. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code for SH & ELF.
|
/* Startup code for SH & ELF.
|
||||||
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
|
Copyright (C) 1999, 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
|
||||||
@ -75,9 +75,9 @@ _start:
|
|||||||
L_main:
|
L_main:
|
||||||
.long main
|
.long main
|
||||||
L_init:
|
L_init:
|
||||||
.long _init
|
.long __libc_csu_init
|
||||||
L_fini:
|
L_fini:
|
||||||
.long _fini
|
.long __libc_csu_fini
|
||||||
L_libc_start_main:
|
L_libc_start_main:
|
||||||
.long __libc_start_main
|
.long __libc_start_main
|
||||||
L_abort:
|
L_abort:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code for elf32-sparc
|
/* Startup code for elf32-sparc
|
||||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
Copyright (C) 1997, 1998, 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 <richard@gnu.ai.mit.edu>, 1997.
|
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ _start:
|
|||||||
|
|
||||||
/* Load the addresses of the user entry points. */
|
/* Load the addresses of the user entry points. */
|
||||||
sethi %hi(main), %o0
|
sethi %hi(main), %o0
|
||||||
sethi %hi(_init), %o3
|
sethi %hi(__libc_csu_init), %o3
|
||||||
sethi %hi(_fini), %o4
|
sethi %hi(__libc_csu_fini), %o4
|
||||||
or %o0, %lo(main), %o0
|
or %o0, %lo(main), %o0
|
||||||
or %o3, %lo(_init), %o3
|
or %o3, %lo(__libc_csu_init), %o3
|
||||||
or %o4, %lo(_fini), %o4
|
or %o4, %lo(__libc_csu_fini), %o4
|
||||||
|
|
||||||
/* When starting a binary via the dynamic linker, %g1 contains the
|
/* When starting a binary via the dynamic linker, %g1 contains the
|
||||||
address of the shared library termination function, which will be
|
address of the shared library termination function, which will be
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code for elf64-sparc
|
/* Startup code for elf64-sparc
|
||||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
Copyright (C) 1997, 1998, 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 <richard@gnu.ai.mit.edu>, 1997.
|
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
|
||||||
|
|
||||||
@ -40,11 +40,11 @@ _start:
|
|||||||
|
|
||||||
/* Load the addresses of the user entry points. */
|
/* Load the addresses of the user entry points. */
|
||||||
sethi %hi(main), %o0
|
sethi %hi(main), %o0
|
||||||
sethi %hi(_init), %o3
|
sethi %hi(__libc_csu_init), %o3
|
||||||
sethi %hi(_fini), %o4
|
sethi %hi(__libc_csu_fini), %o4
|
||||||
or %o0, %lo(main), %o0
|
or %o0, %lo(main), %o0
|
||||||
or %o3, %lo(_init), %o3
|
or %o3, %lo(__libc_csu_init), %o3
|
||||||
or %o4, %lo(_fini), %o4
|
or %o4, %lo(__libc_csu_fini), %o4
|
||||||
|
|
||||||
/* When starting a binary via the dynamic linker, %g1 contains the
|
/* When starting a binary via the dynamic linker, %g1 contains the
|
||||||
address of the shared library termination function, which will be
|
address of the shared library termination function, which will be
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code compliant to the ELF x86-64 ABI.
|
/* Startup code compliant to the ELF x86-64 ABI.
|
||||||
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.
|
||||||
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
|
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ _start:
|
|||||||
pushq %rsp
|
pushq %rsp
|
||||||
|
|
||||||
/* Pass address of our own entry points to .fini and .init. */
|
/* Pass address of our own entry points to .fini and .init. */
|
||||||
movq $_fini, %r8
|
movq $__libc_csu_fini, %r8
|
||||||
movq $_init, %rcx
|
movq $__libc_csu_init, %rcx
|
||||||
|
|
||||||
movq $BP_SYM (main), %rdi
|
movq $BP_SYM (main), %rdi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user