about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-09 20:37:37 +0000
committerRoland McGrath <roland@gnu.org>2002-12-09 20:37:37 +0000
commit06b31ad3ef500de502d461954466018aec10e437 (patch)
tree2a60f2fb3811e74b9fce595943432ddde46f023f
parent58a851f1082519eab4b881036dea70a8ef052f25 (diff)
downloadglibc-06b31ad3ef500de502d461954466018aec10e437.tar.gz
glibc-06b31ad3ef500de502d461954466018aec10e437.tar.xz
glibc-06b31ad3ef500de502d461954466018aec10e437.zip
* 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.
-rw-r--r--ChangeLog23
-rw-r--r--Makeconfig2
-rw-r--r--csu/Makefile3
-rw-r--r--csu/elf-init.c82
-rw-r--r--elf/Makefile2
-rw-r--r--sysdeps/alpha/elf/start.S6
-rw-r--r--sysdeps/arm/elf/start.S6
-rw-r--r--sysdeps/cris/elf/start.S10
-rw-r--r--sysdeps/hppa/elf/start.S37
-rw-r--r--sysdeps/i386/elf/start.S6
-rw-r--r--sysdeps/ia64/elf/start.S6
-rw-r--r--sysdeps/m68k/elf/start.S6
-rw-r--r--sysdeps/mach/hurd/powerpc/static-start.S10
-rw-r--r--sysdeps/mips/elf/start.S4
-rw-r--r--sysdeps/powerpc/powerpc32/elf/start.S8
-rw-r--r--sysdeps/powerpc/powerpc64/elf/start.S12
-rw-r--r--sysdeps/s390/s390-32/elf/start.S10
-rw-r--r--sysdeps/s390/s390-64/elf/start.S6
-rw-r--r--sysdeps/sh/elf/start.S6
-rw-r--r--sysdeps/sparc/sparc32/elf/start.S10
-rw-r--r--sysdeps/sparc/sparc64/elf/start.S10
-rw-r--r--sysdeps/x86_64/elf/start.S6
22 files changed, 193 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index c565441270..f885e3b25c 100644
--- 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.
diff --git a/Makeconfig b/Makeconfig
index b721c4b877..0a43b9c8dc 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -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
 
diff --git a/csu/Makefile b/csu/Makefile
index 6b6991935a..f3b099ee40 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -27,9 +27,10 @@
 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
index 0000000000..c28b73ca62
--- /dev/null
+++ b/csu/elf-init.c
@@ -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 ();
+}
diff --git a/elf/Makefile b/elf/Makefile
index 5ed13c4a7d..16c947e9b4 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -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
diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S
index b0cf119feb..3f98111fd9 100644
--- a/sysdeps/alpha/elf/start.S
+++ b/sysdeps/alpha/elf/start.S
@@ -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
diff --git a/sysdeps/arm/elf/start.S b/sysdeps/arm/elf/start.S
index 8d60b3d8d5..90a62f6d9a 100644
--- a/sysdeps/arm/elf/start.S
+++ b/sysdeps/arm/elf/start.S
@@ -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) */
 
diff --git a/sysdeps/cris/elf/start.S b/sysdeps/cris/elf/start.S
index e7f1d6750d..dbe408a076 100644
--- a/sysdeps/cris/elf/start.S
+++ b/sysdeps/cris/elf/start.S
@@ -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
diff --git a/sysdeps/hppa/elf/start.S b/sysdeps/hppa/elf/start.S
index b2f0bd2ad1..c7e300c543 100644
--- a/sysdeps/hppa/elf/start.S
+++ b/sysdeps/hppa/elf/start.S
@@ -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 */
diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S
index 2fe16c599a..355cba21a1 100644
--- a/sysdeps/i386/elf/start.S
+++ b/sysdeps/i386/elf/start.S
@@ -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.  */
diff --git a/sysdeps/ia64/elf/start.S b/sysdeps/ia64/elf/start.S
index d787c0bf5d..a05ddfbb52 100644
--- a/sysdeps/ia64/elf/start.S
+++ b/sysdeps/ia64/elf/start.S
@@ -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
diff --git a/sysdeps/m68k/elf/start.S b/sysdeps/m68k/elf/start.S
index eda735583d..f65cda75cd 100644
--- a/sysdeps/m68k/elf/start.S
+++ b/sysdeps/m68k/elf/start.S
@@ -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.  */
diff --git a/sysdeps/mach/hurd/powerpc/static-start.S b/sysdeps/mach/hurd/powerpc/static-start.S
index 209972c426..3420fcd31d 100644
--- a/sysdeps/mach/hurd/powerpc/static-start.S
+++ b/sysdeps/mach/hurd/powerpc/static-start.S
@@ -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
@@ -22,13 +22,13 @@
  /* 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"
diff --git a/sysdeps/mips/elf/start.S b/sysdeps/mips/elf/start.S
index 01908e28db..e85e9f535e 100644
--- a/sysdeps/mips/elf/start.S
+++ b/sysdeps/mips/elf/start.S
@@ -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 */
diff --git a/sysdeps/powerpc/powerpc32/elf/start.S b/sysdeps/powerpc/powerpc32/elf/start.S
index 063df75328..04e3d358f1 100644
--- a/sysdeps/powerpc/powerpc32/elf/start.S
+++ b/sysdeps/powerpc/powerpc32/elf/start.S
@@ -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
@@ -23,13 +23,11 @@
  /* 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"
diff --git a/sysdeps/powerpc/powerpc64/elf/start.S b/sysdeps/powerpc/powerpc64/elf/start.S
index 129f126e9d..65fa52c0f5 100644
--- a/sysdeps/powerpc/powerpc64/elf/start.S
+++ b/sysdeps/powerpc/powerpc64/elf/start.S
@@ -23,16 +23,12 @@
  /* 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)
 
diff --git a/sysdeps/s390/s390-32/elf/start.S b/sysdeps/s390/s390-32/elf/start.S
index 0a17543352..1a0436b9a5 100644
--- a/sysdeps/s390/s390-32/elf/start.S
+++ b/sysdeps/s390/s390-32/elf/start.S
@@ -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
 
diff --git a/sysdeps/s390/s390-64/elf/start.S b/sysdeps/s390/s390-64/elf/start.S
index bbc28089f9..687a23cc67 100644
--- a/sysdeps/s390/s390-64/elf/start.S
+++ b/sysdeps/s390/s390-64/elf/start.S
@@ -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.  */
diff --git a/sysdeps/sh/elf/start.S b/sysdeps/sh/elf/start.S
index 5bcb08f236..98eded3886 100644
--- a/sysdeps/sh/elf/start.S
+++ b/sysdeps/sh/elf/start.S
@@ -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:
diff --git a/sysdeps/sparc/sparc32/elf/start.S b/sysdeps/sparc/sparc32/elf/start.S
index 5fd0613463..ca6558ec17 100644
--- a/sysdeps/sparc/sparc32/elf/start.S
+++ b/sysdeps/sparc/sparc32/elf/start.S
@@ -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
diff --git a/sysdeps/sparc/sparc64/elf/start.S b/sysdeps/sparc/sparc64/elf/start.S
index 472dec5ab3..ea7431aae1 100644
--- a/sysdeps/sparc/sparc64/elf/start.S
+++ b/sysdeps/sparc/sparc64/elf/start.S
@@ -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
diff --git a/sysdeps/x86_64/elf/start.S b/sysdeps/x86_64/elf/start.S
index 600aaf2566..6e3fb265af 100644
--- a/sysdeps/x86_64/elf/start.S
+++ b/sysdeps/x86_64/elf/start.S
@@ -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