summaryrefslogtreecommitdiff
path: root/ldso/include/dl-elf.h
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-29 13:47:21 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-29 13:47:21 +0000
commite6816a15ab7d7dbf3ffe75a9a22b4a37909aaf57 (patch)
treeffd16f946ea203cf14cc44c7aaae730cc1032d01 /ldso/include/dl-elf.h
parent223b81b2e707ff3cb99fdf49b7cb6bd1da7f6d21 (diff)
Moved the addition of load address from the fast path
where possible. This will also make ldso smaller. However the patch touches all archs and I have only tested PPC and x86.
Diffstat (limited to 'ldso/include/dl-elf.h')
-rw-r--r--ldso/include/dl-elf.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index a1237b09f..d8f3b382c 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -65,10 +65,10 @@ extern void _dl_protect_relro (struct elf_resolve *l);
#define DYNAMIC_SIZE (DT_NUM+OS_NUM+ARCH_NUM)
-extern void _dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr);
+extern void _dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr, Elf32_Addr load_off);
static inline __attribute__((always_inline))
-void __dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr)
+void __dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void *debug_addr, Elf32_Addr load_off)
{
for (; dpnt->d_tag; dpnt++) {
if (dpnt->d_tag < DT_NUM) {
@@ -97,7 +97,21 @@ void __dl_parse_dynamic_info(Elf32_Dyn *dpnt, unsigned long dynamic_info[], void
}
#endif
}
-}
+# define ADJUST_DYN_INFO(tag, load_off) \
+ do { \
+ if (dynamic_info[tag]) \
+ dynamic_info[tag] += load_off; \
+ } while(0)
+
+ ADJUST_DYN_INFO (DT_HASH, load_off);
+ ADJUST_DYN_INFO (DT_PLTGOT, load_off);
+ ADJUST_DYN_INFO (DT_STRTAB, load_off);
+ ADJUST_DYN_INFO (DT_SYMTAB, load_off);
+ ADJUST_DYN_INFO (DT_RELOC_TABLE_ADDR, load_off);
+ ADJUST_DYN_INFO (DT_JMPREL, load_off);
+# undef ADJUST_DYN_INFO
+
+ }
/* Reloc type classes as returned by elf_machine_type_class().
ELF_RTYPE_CLASS_PLT means this reloc should not be satisfied by