about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--elf/rtld.c2
-rw-r--r--sysdeps/i386/dl-machine.h28
3 files changed, 23 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ac8c20244..f97e882bac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2002-02-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/rtld.c (_dl_start): Mark as internal_function.
+	* sysdeps/i386/dl-machine.h (RTLD_START): Pass parameter for _dl_start
+	in register.
+	(elf_machine_rel): Cleanup and minor optimization for RTLD_BOOTSTRAP.
+	General pretty printing.
+
 2002-01-31  Ulrich Drepper  <drepper@redhat.com>
 
 	* elf/dl-minimal.c: Define _itoa for 32-bit machines with HP timing.
diff --git a/elf/rtld.c b/elf/rtld.c
index af7b27fe24..58d61e70c4 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -125,7 +125,7 @@ RTLD_START
 # error "sysdeps/MACHINE/dl-machine.h fails to define RTLD_START"
 #endif
 
-static ElfW(Addr) __attribute_used__
+static ElfW(Addr) __attribute_used__ internal_function
 _dl_start (void *arg)
 {
   struct link_map bootstrap_map;
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 66392da8fe..a3d3f2580f 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -207,9 +207,9 @@ _dl_runtime_profile:\n\
 .globl _start\n\
 .globl _dl_start_user\n\
 _start:\n\
-	pushl %esp\n\
+	# Note that _dl_start gets the parameter in %eax.\n\
+	movl %esp, %eax\n\
 	call _dl_start\n\
-	popl %ebx\n\
 _dl_start_user:\n\
 	# Save the user entry point address in %edi.\n\
 	movl %eax, %edi\n\
@@ -252,7 +252,7 @@ _dl_start_user:\n\
 ");
 
 #ifndef RTLD_START_SPECIAL_INIT
-#define RTLD_START_SPECIAL_INIT /* nothing */
+# define RTLD_START_SPECIAL_INIT /* nothing */
 #endif
 
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
@@ -305,7 +305,7 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
 /* The i386 never uses Elf32_Rela relocations for the dynamic linker.
    Prelinked libraries may use Elf32_Rela though.  */
 #ifdef RTLD_BOOTSTRAP
-#define ELF_MACHINE_NO_RELA 1
+# define ELF_MACHINE_NO_RELA 1
 #endif
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
@@ -342,17 +342,19 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
   else
 #endif
     {
-#ifndef RTLD_BOOTSTRAP
+#ifdef RTLD_BOOTSTRAP
+      Elf32_Addr value;
+
+      assert (r_type == R_386_GLOB_DAT || r_type == R_386_JMP_SLOT);
+
+      value = RESOLVE (&sym, version, r_type);
+      *reloc_addr = value + sym->st_value;
+#else
       const Elf32_Sym *const refsym = sym;
-#endif
       Elf32_Addr value = RESOLVE (&sym, version, r_type);
       if (sym)
 	value += sym->st_value;
 
-#ifdef RTLD_BOOTSTRAP
-      assert (r_type == R_386_GLOB_DAT || r_type == R_386_JMP_SLOT);
-      *reloc_addr = value;
-#else
       switch (r_type)
 	{
 	case R_386_GLOB_DAT:
@@ -403,7 +405,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
     *reloc_addr = map->l_addr + reloc->r_addend;
   else if (ELF32_R_TYPE (reloc->r_info) != R_386_NONE)
     {
-/*      const Elf32_Sym *const refsym = sym; */
       Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
       if (sym)
 	value += sym->st_value;
@@ -457,9 +458,8 @@ elf_machine_lazy_rel (struct link_map *map,
       if (__builtin_expect (map->l_mach.plt, 0) == 0)
 	*reloc_addr += l_addr;
       else
-	*reloc_addr =
-	  map->l_mach.plt
-	  + (((Elf32_Addr) reloc_addr) - map->l_mach.gotplt) * 4;
+	*reloc_addr = (map->l_mach.plt
+		       + (((Elf32_Addr) reloc_addr) - map->l_mach.gotplt) * 4);
     }
   else
     _dl_reloc_bad_type (map, r_type, 1);