about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2000-04-02 22:01:23 +0000
committerRoland McGrath <roland@gnu.org>2000-04-02 22:01:23 +0000
commit5879ee9fa107553df828f71fd8e6633d3032370a (patch)
tree184e7f19b623b4ddf26ea256b80e11ec350bc884 /sysdeps/i386
parente1724cd7ef4da860e8a1bfbe8adf0e0ec4d0e90f (diff)
downloadglibc-5879ee9fa107553df828f71fd8e6633d3032370a.tar.gz
glibc-5879ee9fa107553df828f71fd8e6633d3032370a.tar.xz
glibc-5879ee9fa107553df828f71fd8e6633d3032370a.zip
* sysdeps/mach/hurd/i386/init-first.c: Replace PIC #ifdefs with SHARED.
	(init1): Don't initialize __environ here, since init already does it.
	(first_init): New function, broken out of _init.
	(_hurd_stack_setup): Use it.
	[SHARED] (_dl_init_first): New function, renamed from old _init.
	(init1) [SHARED]: Don't call posixland_init here.
	(posixland_init): Take ENVP arg, so signature is usual for initializer.
	[SHARED] (_init): Define as alias for posixland_init.
	[! SHARED] (__libc_first_init): Define as alias for posixland_init.
	* sysdeps/i386/dl-machine.h (RTLD_START): Insert the macro
	RTLD_START_SPECIAL_INIT before calling initializers.
	(RTLD_START_SPECIAL_INIT): Define to empty if undefined.
	* sysdeps/mach/hurd/i386/dl-machine.h: New file.
	* sysdeps/mach/hurd/dl-sysdep.c (_dl_init_first): New weak function.
	* elf/Versions ({libc,ld.so}: GLIBC_2.2): Add _dl_init_first.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/dl-machine.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 507a69d338..753f12678f 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  i386 version.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000 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
@@ -223,19 +223,24 @@ _dl_start_user:\n\
 	popl %esi\n\
 	# Adjust the stack pointer to skip _dl_skip_args words.\n\
 	leal (%esp,%eax,4), %esp\n\
-	# Subtract _dl_skip_args from it.\n\
+	# Subtract _dl_skip_args from argc.\n\
 	subl %eax, %esi\n\
+	# Push argc back on the stack.\n\
+	push %esi\n\
+	# The special initializer gets called with the stack just\n\
+	# as the application's entry point will see it; it can\n\
+	# switch stacks if it moves these contents over.\n\
+" RTLD_START_SPECIAL_INIT "\n\
 	# Load the parameters again.\n\
-	leal 4(%esp,%esi,4), %edx\n\
-	movl %esp, %ecx\n\
+	# (eax, edx, ecx, *--esp) = (_dl_loaded, argc, argv, envp)\n\
+	leal 8(%esp,%esi,4), %edx\n\
+	leal 4(%esp), %ecx\n\
 	pushl %edx\n\
 	movl %esi, %edx\n\
 	movl _dl_loaded@GOT(%ebx), %eax\n\
 	movl (%eax), %eax\n\
 	# Call the function to run the initializers.\n\
 	call _dl_init@PLT\n\
-	# Push argc back on the stack.\n\
-	push %esi\n\
 	# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
 	movl _dl_fini@GOT(%ebx), %edx\n\
 	# Jump to the user's entry point.\n\
@@ -243,6 +248,10 @@ _dl_start_user:\n\
 .previous\n\
 ");
 
+#ifndef RTLD_START_SPECIAL_INIT
+#define RTLD_START_SPECIAL_INIT /* nothing */
+#endif
+
 /* Nonzero iff TYPE should not be allowed to resolve to one of
    the main executable's symbols, as for a COPY reloc.  */
 #define elf_machine_lookup_noexec_p(type) ((type) == R_386_COPY)