From a711b01d34ca5de9857ca5d19235812674fccee6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 26 Aug 2001 09:17:23 +0000 Subject: Update. 2001-08-26 Ulrich Drepper * config.h.in: Add HAVE_Z_COMBRELOC. * configure.in: Add test for -z combreloc. * sysdeps/i386/dl-machine.h (elf_machine_rel): Minor cleanups and optimizations. Use HAVE_Z_COMBRELOC to avoid generaton of R_386_RELATIVE handling for ld.so startup. --- sysdeps/i386/dl-machine.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 6b6c91e..53d8022 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -305,9 +305,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, { const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); +#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC if (__builtin_expect (r_type == R_386_RELATIVE, 0)) { -#ifndef RTLD_BOOTSTRAP +# ifndef RTLD_BOOTSTRAP /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c @@ -316,14 +317,15 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, weak decl in the same file. */ weak_extern (_dl_rtld_map); if (map != &_dl_rtld_map) /* Already done in rtld itself. */ -#endif +# endif *reloc_addr += map->l_addr; } -#ifndef RTLD_BOOTSTRAP +# ifndef RTLD_BOOTSTRAP else if (__builtin_expect (r_type == R_386_NONE, 0)) return; -#endif +# endif else +#endif { #ifndef RTLD_BOOTSTRAP const Elf32_Sym *const refsym = sym; @@ -352,7 +354,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && _dl_verbose)) { const char *strtab; @@ -365,8 +367,6 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, memcpy (reloc_addr, (void *) value, MIN (sym->st_size, refsym->st_size)); break; -#endif -#if !defined RTLD_BOOTSTRAP || defined _NDEBUG default: /* We add these checks in the version to relocate ld.so only if we are still debugging. */ @@ -381,6 +381,7 @@ static inline void elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, Elf32_Addr *const reloc_addr) { + assert (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE); *reloc_addr += l_addr; } -- cgit v1.1