aboutsummaryrefslogtreecommitdiff
path: root/elf/do-rel.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-16 09:34:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-16 09:34:51 -0400
commite453f6cd0ccdd64a3f5f156e2c5f70085e9289e7 (patch)
tree52ffc06dedd14b973a77112d6847614eb976542f /elf/do-rel.h
parent79b195b55af84a9044dfb26ebdc49d9f308829af (diff)
downloadglibc-e453f6cd0ccdd64a3f5f156e2c5f70085e9289e7.zip
glibc-e453f6cd0ccdd64a3f5f156e2c5f70085e9289e7.tar.gz
glibc-e453f6cd0ccdd64a3f5f156e2c5f70085e9289e7.tar.bz2
Fix potential problem with skipping relocations
We never seem to have hit this problem but way relative relocations were skipped was wrong. There are relative relocations only in the DT_REL/DT_RELA section. The elf_dynamic_do_##reloc function skipped the entries in all calls, though.
Diffstat (limited to 'elf/do-rel.h')
-rw-r--r--elf/do-rel.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/elf/do-rel.h b/elf/do-rel.h
index 6187b9e..69f2f0e 100644
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -21,13 +21,10 @@
`elf_dynamic_do_rel' and `elf_dynamic_do_rela'. */
#ifdef DO_RELA
-# define elf_dynamic_do_rel elf_dynamic_do_rela
-# define RELCOUNT_IDX VERSYMIDX (DT_RELACOUNT)
+# define elf_dynamic_do_Rel elf_dynamic_do_Rela
# define Rel Rela
# define elf_machine_rel elf_machine_rela
# define elf_machine_rel_relative elf_machine_rela_relative
-#else
-# define RELCOUNT_IDX VERSYMIDX (DT_RELCOUNT)
#endif
#ifndef DO_ELF_MACHINE_REL_RELATIVE
@@ -50,9 +47,9 @@
than fully resolved now. */
auto inline void __attribute__ ((always_inline))
-elf_dynamic_do_rel (struct link_map *map,
+elf_dynamic_do_Rel (struct link_map *map,
ElfW(Addr) reladdr, ElfW(Addr) relsize,
- int lazy, int skip_ifunc)
+ ElfW(Word) nrelative, int lazy, int skip_ifunc)
{
const ElfW(Rel) *r = (const void *) reladdr;
const ElfW(Rel) *end = (const void *) (reladdr + relsize);
@@ -73,10 +70,8 @@ elf_dynamic_do_rel (struct link_map *map,
{
const ElfW(Sym) *const symtab =
(const void *) D_PTR (map, l_info[DT_SYMTAB]);
- ElfW(Word) nrelative = (map->l_info[RELCOUNT_IDX] == NULL
- ? 0 : map->l_info[RELCOUNT_IDX]->d_un.d_val);
const ElfW(Rel) *relative = r;
- r = r + MIN (nrelative, relsize / sizeof (ElfW(Rel)));
+ r += nrelative;
#ifndef RTLD_BOOTSTRAP
/* This is defined in rtld.c, but nowhere in the static libc.a; make
@@ -131,9 +126,9 @@ elf_dynamic_do_rel (struct link_map *map,
}
}
-#undef elf_dynamic_do_rel
+#undef elf_dynamic_do_Rel
#undef Rel
#undef elf_machine_rel
#undef elf_machine_rel_relative
#undef DO_ELF_MACHINE_REL_RELATIVE
-#undef RELCOUNT_IDX
+#undef DO_RELA