From a60180c2655f71ba2f9ed3ab66d328f48d9ad772 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 5 Jul 2006 19:17:19 +0000 Subject: patch from Bernd Schmidt to abstract away load address types --- ldso/include/dl-defs.h | 9 +++++++++ ldso/include/dl-elf.h | 6 ++++-- ldso/include/dl-hash.h | 4 ++-- ldso/include/ldso.h | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) (limited to 'ldso/include') diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index 18f718bef..5cf260183 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -66,6 +66,15 @@ typedef struct { #endif +/* Machines in which different sections may be relocated by different + * amounts should define this and LD_RELOC_ADDR. If you change this, + * make sure you change struct link_map in include/link.h accordingly + * such that it matches a prefix of struct elf_resolve. + */ +#ifndef DL_LOADADDR_TYPE +# define DL_LOADADDR_TYPE ElfW(Addr) +#endif + /* Initialize a LOADADDR representing the loader itself. It's only * called from DL_BOOT, so additional arguments passed to it may be * referenced. diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index de404aec1..7b609d592 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -94,10 +94,12 @@ extern void _dl_protect_relro (struct elf_resolve *l); #define DYNAMIC_SIZE (DT_NUM+OS_NUM+ARCH_NUM) -extern void _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], void *debug_addr, ElfW(Addr) load_off); +extern void _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], + void *debug_addr, DL_LOADADDR_TYPE load_off); static __always_inline -void __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], void *debug_addr, ElfW(Addr) load_off) +void __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], + void *debug_addr, DL_LOADADDR_TYPE load_off) { for (; dpnt->d_tag; dpnt++) { if (dpnt->d_tag < DT_NUM) { diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index ad5c16318..8f30688d1 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -28,7 +28,7 @@ struct dyn_elf { struct elf_resolve { /* These entries must be in this order to be compatible with the interface used by gdb to obtain the list of symbols. */ - ElfW(Addr) loadaddr; /* Base address shared object is loaded at. */ + DL_LOADADDR_TYPE loadaddr; /* Base address shared object is loaded at. */ char *libname; /* Absolute file name object was found in. */ ElfW(Dyn) *dynamic_addr; /* Dynamic section of the shared object. */ struct elf_resolve * next; @@ -77,7 +77,7 @@ extern struct elf_resolve * _dl_loaded_modules; extern struct dyn_elf * _dl_handles; extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname, - ElfW(Addr) loadaddr, unsigned long * dynamic_info, + DL_LOADADDR_TYPE loadaddr, unsigned long * dynamic_info, unsigned long dynamic_addr, unsigned long dynamic_size); extern char * _dl_find_hash(const char * name, struct dyn_elf * rpnt1, diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 6b1e9cb4e..47b2fb513 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -88,7 +88,7 @@ extern void _dl_unsetenv(const char *symbol, char **envp); extern char *_dl_strdup(const char *string); extern void _dl_dprintf(int, const char *, ...); -extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, ElfW(Addr) load_addr, - ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv); +extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, + ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv); #endif /* _LDSO_H_ */ -- cgit v1.2.3