From 5879ee9fa107553df828f71fd8e6633d3032370a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 2 Apr 2000 22:01:23 +0000 Subject: * 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. --- sysdeps/i386/dl-machine.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'sysdeps/i386/dl-machine.h') 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) -- cgit 1.4.1