* elf/Makefile (tests): Uncomment tst-array[123].
authorRoland McGrath <roland@gnu.org>
Mon, 9 Dec 2002 20:37:37 +0000 (20:37 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 9 Dec 2002 20:37:37 +0000 (20:37 +0000)
* 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.

22 files changed:
ChangeLog
Makeconfig
csu/Makefile
csu/elf-init.c [new file with mode: 0644]
elf/Makefile
sysdeps/alpha/elf/start.S
sysdeps/arm/elf/start.S
sysdeps/cris/elf/start.S
sysdeps/hppa/elf/start.S
sysdeps/i386/elf/start.S
sysdeps/ia64/elf/start.S
sysdeps/m68k/elf/start.S
sysdeps/mach/hurd/powerpc/static-start.S
sysdeps/mips/elf/start.S
sysdeps/powerpc/powerpc32/elf/start.S
sysdeps/powerpc/powerpc64/elf/start.S
sysdeps/s390/s390-32/elf/start.S
sysdeps/s390/s390-64/elf/start.S
sysdeps/sh/elf/start.S
sysdeps/sparc/sparc32/elf/start.S
sysdeps/sparc/sparc64/elf/start.S
sysdeps/x86_64/elf/start.S

index c565441..f885e3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
 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
        struct containing function ptr and value, free it.
        (__aio_notify_only): Allocate that and copy values from SIGEV into it.
index b721c4b..0a43b9c 100644 (file)
@@ -711,7 +711,7 @@ object-suffixes-for-libc += .oS
 # shared objects.  We don't want to use CFLAGS-os because users may, for
 # example, make that processor-specific.
 CFLAGS-.oS = $(CFLAGS-.o) $(pic-ccflag)
-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC
+CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
 libtype.oS = lib%_nonshared.a
 endif
 
index 6b69919..f3b099e 100644 (file)
 subdir := csu
 
 routines = init-first libc-start $(libc-init) sysdep version check_fds \
-          libc-tls
+          libc-tls elf-init
 aux     = errno
 elide-routines.os = libc-tls
+static-only-routines = elf-init
 csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
 extra-objs = start.o gmon-start.o \
             $(start-installed-name) g$(start-installed-name) $(csu-dummies)
diff --git a/csu/elf-init.c b/csu/elf-init.c
new file mode 100644 (file)
index 0000000..c28b73c
--- /dev/null
@@ -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 ();
+}
index 5ed13c4..16c947e 100644 (file)
@@ -118,7 +118,7 @@ endif
 
 tests = tst-tls1 tst-tls2 tst-tls9
 ifeq (yes,$(have-initfini-array))
-#tests += tst-array1 tst-array2 tst-array3
+tests += tst-array1 tst-array2 tst-array3
 endif
 ifeq (yes,$(build-static))
 tests-static = tst-tls1-static tst-tls2-static
index b0cf119..3f98111 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
    Contributed by Richard Henderson <rth@tamu.edu>
 
@@ -40,8 +40,8 @@ _start:
        lda     a2, 24(sp)      /* get argv */
 
   /* Load address of our own entry points to .fini and .init.  */
-       lda     a3, _init
-       lda     a4, _fini
+       lda     a3, __libc_csu_init
+       lda     a4, __libc_csu_fini
 
   /* Store address of the shared library termination function.  */
        mov     v0, a5
index 8d60b3d..90a62f6 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    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 */
        stmfd sp!, {a1}
-       ldr a1, =_fini
+       ldr a1, =__libc_csu_fini
        stmfd sp!, {a1}
 
        /* Set up the other arguments for main() that go in registers */
        ldr a1, =main
-       ldr a4, =_init
+       ldr a4, =__libc_csu_init
 
        /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
 
index e7f1d67..dbe408a 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -89,15 +89,15 @@ _start:
        move.d  pc,r0
        sub.d   .:GOTOFF,r0
 
-       move.d  _init:PLTG,r13
+       move.d  __libc_csu_init:PLTG,r13
        add.d   r0,r13
-       move.d  _fini:PLTG,r9
+       move.d  __libc_csu_fini:PLTG,r9
        add.d   r0,r9
        move.d  main:PLTG,r10
        add.d   r0,r10
 #else
-       move.d  _init,r13
-       move.d  _fini,r9
+       move.d  __libc_csu_init,r13
+       move.d  __libc_csu_fini,r9
        move.d  main,r10
 #endif
        push    r9
index b2f0bd2..c7e300c 100644 (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
 
@@ -6,12 +24,9 @@
        .import main, code
        .import $global$, data
        .import __libc_start_main, code
-       .import _fini, code
-       .import _init, code
+       .import __libc_csu_fini, code
+       .import __libc_csu_init, code
 
-       
-       
-       
        .globl _start
        .export _start, ENTRY
        .type _start,@function
@@ -28,17 +43,17 @@ _start:
 
        /* Expand the stack to store the 5th through 7th args */
        ldo     64(%sp), %sp
-       
+
        /* void (*rtld_fini) (void) (actually the 6th arg) */
        stw     %r23, -56(%sp)
-       
+
        /* void (*init) (void) */
-       ldil    LP%_init, %r23
-       ldo     RP%_init(%r23), %r23
+       ldil    LP%__libc_csu_init, %r23
+       ldo     RP%__libc_csu_init(%r23), %r23
 
        /* void (*fini) (void) */
-       ldil    LP%_fini, %r22
-       ldo     RP%_fini(%r22), %r22
+       ldil    LP%__libc_csu_fini, %r22
+       ldo     RP%__libc_csu_fini(%r22), %r22
        stw     %r22, -52(%sp)
 
        /* void *stack_end */
index 2fe16c5..355cba2 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -68,8 +68,8 @@ _start:
                                   termination function.  */
 
        /* Push address of our own entry points to .fini and .init.  */
-       pushl $_fini
-       pushl $_init
+       pushl $__libc_csu_fini
+       pushl $__libc_csu_init
 
        pushl %ecx              /* Push second argument: argv.  */
        pushl %esi              /* Push first argument: argc.  */
index d787c0b..a05ddfb 100644 (file)
@@ -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.
    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 out0 = @ltoff(@fptr(main)), gp
-         addl out3 = @ltoff(@fptr(_init)), gp
+         addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
          ;;
        }
        { .mmi
          ld8 r3 = [r11]        /* pointer to __libc_ia64_register_backing_store_base */
          ld8 out0 = [out0]     /* pointer to `main' function descriptor */
-         addl out4 = @ltoff(@fptr(_fini)), gp
+         addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
          ;;
        }
        { .mmi
index eda7355..f65cda7 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    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
           `.init'.  */
-       pea _fini
-       pea _init
+       pea __libc_csu_fini
+       pea __libc_csu_init
 
        pea (%a0)               /* Push second argument: argv.  */
        move.l %d0, -(%sp)      /* Push first argument: argc.  */
index 209972c..3420fcd 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
  /* These are the various addresses we require.  */
        .section ".rodata"
        .align  2
-       weak_extern(_init)
-       weak_extern(_fini)
+       weak_extern(__libc_csu_init)
+       weak_extern(__libc_csu_fini)
 L(start_addresses):
        .long   _SDA_BASE_
        .long   JUMPTARGET(main)
-       .long   JUMPTARGET(_init)
-       .long   JUMPTARGET(_fini)
+       .long   JUMPTARGET(__libc_csu_init)
+       .long   JUMPTARGET(__libc_csu_fini)
        ASM_SIZE_DIRECTIVE(L(start_addresses))
 
        .section ".text"
index 01908e2..e85e9f5 100644 (file)
@@ -83,8 +83,8 @@ ENTRY_POINT:
           the stack is aligned to double words (8 bytes).  */
        and $29, 0xfffffff8
        subu $29, 32
-       la $7, _init            /* init */
-       la $8, _fini
+       la $7, __libc_csu_init          /* init */
+       la $8, __libc_csu_fini
        sw $8, 16($29)          /* fini */
        sw $2, 20($29)          /* rtld_fini */
        sw $29, 24($29)         /* stack_end */
index 063df75..04e3d35 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
  /* These are the various addresses we require.  */
        .section ".rodata"
        .align  2
-       weak_extern(_init)
-       weak_extern(_fini)
 L(start_addresses):
        .long   _SDA_BASE_
        .long   JUMPTARGET(BP_SYM (main))
-       .long   JUMPTARGET(_init)
-       .long   JUMPTARGET(_fini)
+       .long   JUMPTARGET(__libc_csu_init)
+       .long   JUMPTARGET(__libc_csu_fini)
        ASM_SIZE_DIRECTIVE(L(start_addresses))
 
        .section ".text"
index 129f126..65fa52c 100644 (file)
  /* These are the various addresses we require.  */
        .section ".rodata"
        .align  3
-       weak_extern(_init)
-       weak_extern(_fini) 
-       weak_extern(._init)
-       weak_extern(._fini) 
 L(start_addresses):
        .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
 /*     function descriptors so don't need JUMPTARGET */
-       .quad   BP_SYM(main) 
-       .quad   _init
-       .quad   _fini 
+       .quad   BP_SYM(main)
+       .quad   __libc_csu_init
+       .quad   __libc_csu_fini
 
        ASM_SIZE_DIRECTIVE(L(start_addresses))
 
@@ -55,7 +51,7 @@ ENTRY(_start)
        ld      r8,.L01(r2)
 
  /* and continue in libc-start, in glibc.  */
-       b       JUMPTARGET(BP_SYM(__libc_start_main)) 
+       b       JUMPTARGET(BP_SYM(__libc_start_main))
 
 END(_start)
 
index 0a17543..1a0436b 100644 (file)
@@ -1,5 +1,5 @@
 /* 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).
    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
        la      %r7,96(%r15)
-       l       %r6,.L2-.Llit(%r13)     # load pointer to _fini
-       l       %r5,.L1-.Llit(%r13)     # load pointer to _init
+       l       %r6,.L2-.Llit(%r13)     # load pointer to __libc_csu_fini
+       l       %r5,.L1-.Llit(%r13)     # load pointer to __libc_csu_init
        l       %r2,.L3-.Llit(%r13)     # load pointer to main
 
        /* ok, now branch to the libc main routine */
@@ -75,8 +75,8 @@ _start:
        .word   0
 
 .Llit:
-.L1:    .long  _init
-.L2:    .long  _fini
+.L1:    .long  __libc_csu_init
+.L2:    .long  __libc_csu_fini
 .L3:    .long  main
 .L4:    .long  __libc_start_main
 
index bbc2808..687a23c 100644 (file)
@@ -1,5 +1,5 @@
 /* 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).
    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
        la      %r7,160(%r15)
-       larl    %r6,_fini               # load pointer to _fini
-       larl    %r5,_init               # load pointer to _init
+       larl    %r6,__libc_csu_fini     # load pointer to __libc_csu_fini
+       larl    %r5,__libc_csu_init     # load pointer to __libc_csu_init
        larl    %r2,main                # load pointer to main
 
        /* Ok, now branch to the libc main routine.  */
index 5bcb08f..98eded3 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -75,9 +75,9 @@ _start:
 L_main:
        .long   main
 L_init:
-       .long   _init
+       .long   __libc_csu_init
 L_fini:
-       .long   _fini
+       .long   __libc_csu_fini
 L_libc_start_main:
        .long   __libc_start_main
 L_abort:
index 5fd0613..ca6558e 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -39,11 +39,11 @@ _start:
 
   /* Load the addresses of the user entry points.  */
        sethi   %hi(main), %o0
-       sethi   %hi(_init), %o3
-       sethi   %hi(_fini), %o4
+       sethi   %hi(__libc_csu_init), %o3
+       sethi   %hi(__libc_csu_fini), %o4
        or      %o0, %lo(main), %o0
-       or      %o3, %lo(_init), %o3
-       or      %o4, %lo(_fini), %o4
+       or      %o3, %lo(__libc_csu_init), %o3
+       or      %o4, %lo(__libc_csu_fini), %o4
 
   /* When starting a binary via the dynamic linker, %g1 contains the
      address of the shared library termination function, which will be
index 472dec5..ea7431a 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -40,11 +40,11 @@ _start:
 
   /* Load the addresses of the user entry points.  */
         sethi   %hi(main), %o0
-        sethi   %hi(_init), %o3
-        sethi   %hi(_fini), %o4
+        sethi   %hi(__libc_csu_init), %o3
+        sethi   %hi(__libc_csu_fini), %o4
         or      %o0, %lo(main), %o0
-        or      %o3, %lo(_init), %o3
-        or      %o4, %lo(_fini), %o4
+        or      %o3, %lo(__libc_csu_init), %o3
+        or      %o4, %lo(__libc_csu_fini), %o4
 
   /* When starting a binary via the dynamic linker, %g1 contains the
      address of the shared library termination function, which will be
index 600aaf2..6e3fb26 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
    Contributed by Andreas Jaeger <aj@suse.de>, 2001.
 
@@ -75,8 +75,8 @@ _start:
        pushq %rsp
 
        /* Pass address of our own entry points to .fini and .init.  */
-       movq $_fini, %r8
-       movq $_init, %rcx
+       movq $__libc_csu_fini, %r8
+       movq $__libc_csu_init, %rcx
 
        movq $BP_SYM (main), %rdi