diff options
Diffstat (limited to 'ldso/include')
-rw-r--r-- | ldso/include/dl-elf.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 9c2888f5b..cbb2100b1 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -162,15 +162,18 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info if (dynamic_info[tag]) \ dynamic_info[tag] = (unsigned long) DL_RELOC_ADDR(load_off, dynamic_info[tag]); \ } 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); + /* Don't adjust .dynamic unnecessarily. */ + if (load_off != 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); #ifdef __LDSO_GNU_HASH_SUPPORT__ - ADJUST_DYN_INFO(DT_GNU_HASH_IDX, load_off); + ADJUST_DYN_INFO(DT_GNU_HASH_IDX, load_off); #endif + } #undef ADJUST_DYN_INFO return rtld_flags; } |