aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-31 08:28:44 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-31 08:28:44 +0000
commita778db0624f4359cd0e1aea9384235d4a376b1a8 (patch)
tree5d154b71f8bc82f277b570cd80e819c6fd011f97
parentfbcc0996a825f961bf7669fa54b58027b0e663ec (diff)
downloadglibc-a778db0624f4359cd0e1aea9384235d4a376b1a8.tar
glibc-a778db0624f4359cd0e1aea9384235d4a376b1a8.tar.gz
glibc-a778db0624f4359cd0e1aea9384235d4a376b1a8.tar.bz2
glibc-a778db0624f4359cd0e1aea9384235d4a376b1a8.zip
Update.
* sysdeps/i386/dl-machine.h (elf_machine_rel): For the version to relocate ld.so don't add supprt for relocations which should not appear in ld.so.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/i386/dl-machine.h49
2 files changed, 26 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b8f6cca9a..8d25c92c9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2000-08-31 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/i386/dl-machine.h (elf_machine_rel): For the version to
+ relocate ld.so don't add supprt for relocations which should not
+ appear in ld.so.
+
* malloc/malloc.c (ptmalloc_init): Optimize a bit by not calling
__secure_getenv. Instead test __libc_enable_secure once.
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 1f787a5319..61b419c091 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -312,6 +312,13 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
{
#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
+ (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
+ common defn for _dl_rtld_map, which is incompatible with a
+ weak decl in the same file. */
+ weak_extern (_dl_rtld_map);
if (map != &_dl_rtld_map) /* Already done in rtld itself. */
#endif
*reloc_addr += map->l_addr;
@@ -325,6 +332,17 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
switch (ELF32_R_TYPE (reloc->r_info))
{
+ case R_386_GLOB_DAT:
+ case R_386_JMP_SLOT:
+ *reloc_addr = value;
+ break;
+#ifndef RTLD_BOOTSTRAP
+ case R_386_32:
+ *reloc_addr += value;
+ break;
+ case R_386_PC32:
+ *reloc_addr += (value - (Elf32_Addr) reloc_addr);
+ break;
case R_386_COPY:
if (sym == NULL)
/* This can happen in trace mode if an object could not be
@@ -345,37 +363,14 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
break;
- case R_386_GLOB_DAT:
- case R_386_JMP_SLOT:
- *reloc_addr = value;
- break;
- case R_386_32:
- {
-#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 (i.e. #ifdef RTLD_BOOTSTRAP) because
- rtld.c contains the common defn for _dl_rtld_map, which
- is incompatible with a weak decl in the same file. */
- weak_extern (_dl_rtld_map);
- if (map == &_dl_rtld_map)
- /* Undo the relocation done here during bootstrapping.
- Now we will relocate it anew, possibly using a
- binding found in the user program or a loaded library
- rather than the dynamic linker's built-in definitions
- used while loading those libraries. */
- value -= map->l_addr + refsym->st_value;
#endif
- *reloc_addr += value;
- break;
- }
- case R_386_PC32:
- *reloc_addr += (value - (Elf32_Addr) reloc_addr);
- break;
+#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
default:
+ /* We add these checks in the version to relocate ld.so only
+ if we are still debugging. */
_dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0);
break;
+#endif
}
}
}