diff options
Diffstat (limited to 'ldso/include')
-rw-r--r-- | ldso/include/dl-defs.h | 7 | ||||
-rw-r--r-- | ldso/include/dl-elf.h | 5 | ||||
-rw-r--r-- | ldso/include/dl-hash.h | 18 |
3 files changed, 28 insertions, 2 deletions
diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index 19eab074f..21a66a40f 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -181,4 +181,11 @@ typedef struct { #define __C_SYMBOL_PREFIX__ "_" #endif +/* Define this if you want to modify the VALUE returned by + _dl_find_hash for this reloc TYPE. TPNT is the module in which the + matching SYM was found. */ +#ifndef DL_FIND_HASH_VALUE +# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr)) +#endif + #endif /* _LD_DEFS_H */ diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 3e418622d..320a0f920 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -183,6 +183,11 @@ void __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], #endif #define ELF_RTYPE_CLASS_PLT (0x1) +/* dlsym() calls _dl_find_hash with this value, that enables + DL_FIND_HASH_VALUE to return something different than the symbol + itself, e.g., a function descriptor. */ +#define ELF_RTYPE_CLASS_DLSYM 0x80000000 + /* Convert between the Linux flags for page protections and the ones specified in the ELF standard. */ diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index 5239467c1..e5f9f8806 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -105,8 +105,22 @@ extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname, 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, - struct elf_resolve *mytpnt, int type_class); +extern char * _dl_lookup_hash(const char * name, struct dyn_elf * rpnt, + struct elf_resolve *mytpnt, int type_class +#ifdef __FDPIC__ + , struct elf_resolve **tpntp +#endif + ); + +static __always_inline char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, + struct elf_resolve *mytpnt, int type_class) +{ +#ifdef __FDPIC__ + return _dl_lookup_hash(name, rpnt, mytpnt, type_class, NULL); +#else + return _dl_lookup_hash(name, rpnt, mytpnt, type_class); +#endif +} extern int _dl_linux_dynamic_link(void); |