diff options
author | Salvatore Cro <salvatore.cro@st.com> | 2011-01-12 10:27:16 +0100 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2011-01-20 14:51:42 +0100 |
commit | aaf4cbd98fda76af93ebea5241f65291ff6bcaac (patch) | |
tree | e74a6dfb7639f30be2a8c723fc44e92b63b84538 /ldso/include/dl-hash.h | |
parent | c70ac1d9b290e70cbc789b0abb47337f8aa9faef (diff) |
Add protected symbols support for all architectures
Protected symbols are global symbols for which interposition is not allowed.
We manage them in generic _dl_lookup_hash function. To handle protected symbols
we need to get a reference to the module that defines the symbol itself.
So we pass a new parameter 'struct symbol_ref' to the __dl_lookup_hash
that is defined as below:
struct symbol_ref {
const ElfW(Sym) *sym;
struct elf_resolve *tpnt;
};
The tpnt field is used as an ouput parameter and refers to the module which defines
the protected symbol.
Further it can be used as output parameter for TLS relocations and FDPIC case.
The sym field is instead used as an input parameter to detect the visibility of the
symbol we are looking-up.
In this way we get rid of different signatures for _dl_lookup_hash, allowing to remove
the _dl_find_hash wrapper.
This new structure is also suitable for prelink integration.
Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'ldso/include/dl-hash.h')
-rw-r--r-- | ldso/include/dl-hash.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index 34bed1b4b..d1f9accc5 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -25,6 +25,11 @@ struct dyn_elf { struct dyn_elf * prev; }; +struct symbol_ref { + const ElfW(Sym) *sym; + struct elf_resolve *tpnt; +}; + 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. */ @@ -137,19 +142,14 @@ 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); -/* Only need extra arg with some configurations */ -#if !((defined(USE_TLS) && USE_TLS) || defined __FDPIC__) -# define _dl_lookup_hash(n, r, m, c, tpntp) _dl_lookup_hash(n, r, m, c) -# define _dl_find_hash(n, r, m, t, tpntp) _dl_find_hash(n, r, m, t) -#endif extern char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class, - struct elf_resolve **tpntp); + struct symbol_ref *symbol); static __always_inline char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class, - struct elf_resolve **tpntp) + struct symbol_ref *symbol) { - return _dl_lookup_hash(name, rpnt, mytpnt, type_class, tpntp); + return _dl_lookup_hash(name, rpnt, mytpnt, type_class, symbol); } extern int _dl_linux_dynamic_link(void); |