From e6816a15ab7d7dbf3ffe75a9a22b4a37909aaf57 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Tue, 29 Mar 2005 13:47:21 +0000 Subject: 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. --- ldso/include/dl-elf.h | 20 +++++++++++++++++--- ldso/include/dl-hash.h | 1 - 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'ldso/include') 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 diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index cc0d389f6..53e17302a 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -77,7 +77,6 @@ extern int _dl_linux_dynamic_link(void); extern char * _dl_library_path; extern char * _dl_not_lazy; -extern unsigned long _dl_elf_hash(const unsigned char *name); static inline int _dl_symbol(char * name) { -- cgit v1.2.3