summaryrefslogtreecommitdiff
path: root/ldso/include/dl-elf.h
diff options
context:
space:
mode:
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