summaryrefslogtreecommitdiff
path: root/ldso/ldso/mips
diff options
context:
space:
mode:
authorSalvatore Cro <salvatore.cro@st.com>2011-01-12 10:27:16 +0100
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-01-20 14:51:42 +0100
commitaaf4cbd98fda76af93ebea5241f65291ff6bcaac (patch)
treee74a6dfb7639f30be2a8c723fc44e92b63b84538 /ldso/ldso/mips
parentc70ac1d9b290e70cbc789b0abb47337f8aa9faef (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/ldso/mips')
-rw-r--r--ldso/ldso/mips/elfinterp.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index a56ee81b4..2886f333d 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -212,23 +212,27 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
case R_MIPS_TLS_TPREL32:
# endif
{
- struct elf_resolve *tpnt_tls = NULL;
+ struct elf_resolve *tls_tpnt = NULL;
+ struct symbol_ref sym_ref;
+ sym_ref.sym = &symtab[symtab_index];
+ sym_ref.tpnt = NULL;
if (ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_LOCAL) {
symbol_addr = (unsigned long) _dl_find_hash(symname, tpnt->symbol_scope,
- tpnt, elf_machine_type_class(reloc_type), &tpnt_tls);
+ tpnt, elf_machine_type_class(reloc_type), &sym_ref);
+ tls_tpnt = sym_ref.tpnt;
}
- /* In case of a TLS reloc, tpnt_tls NULL means we have an 'anonymous'
+ /* In case of a TLS reloc, tls_tpnt NULL means we have an 'anonymous'
symbol. This is the case for a static tls variable, so the lookup
module is just that one is referencing the tls variable. */
- if (!tpnt_tls)
- tpnt_tls = tpnt;
+ if (!tls_tpnt)
+ tls_tpnt = tpnt;
switch (reloc_type) {
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPMOD32:
- if (tpnt_tls)
- *(ElfW(Word) *)reloc_addr = tpnt_tls->l_tls_modid;
+ if (tls_tpnt)
+ *(ElfW(Word) *)reloc_addr = tls_tpnt->l_tls_modid;
#ifdef __SUPPORT_LD_DEBUG__
_dl_dprintf(2, "TLS_DTPMOD : %s, %d, %d\n",
symname, old_val, *((unsigned int *)reloc_addr));
@@ -247,9 +251,9 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
case R_MIPS_TLS_TPREL32:
case R_MIPS_TLS_TPREL64:
- CHECK_STATIC_TLS((struct link_map *)tpnt_tls);
+ CHECK_STATIC_TLS((struct link_map *)tls_tpnt);
*(ElfW(Word) *)reloc_addr +=
- TLS_TPREL_VALUE (tpnt_tls, symbol_addr);
+ TLS_TPREL_VALUE (tls_tpnt, symbol_addr);
#ifdef __SUPPORT_LD_DEBUG__
_dl_dprintf(2, "TLS_TPREL : %s, %x, %x\n",
symname, old_val, *((unsigned int *)reloc_addr));