From 68115c38cef4bddb52928e58cdefcb45855bc6f4 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Thu, 20 Jan 2011 14:46:44 +0100 Subject: Revert "ldso/i386: support protected symbols" This reverts commit ba38f0cec27b91cc7c605417ad047c4dc77d732f. The generic implementation will cover all the architectures handling the protected symbols in _dl_lookup_hash [ldso/ldso/dl-hash.c] Signed-off-by: Carmelo Amoroso --- ldso/ldso/i386/elfinterp.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'ldso/ldso/i386') diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index 1e3a2b248..a01c1d020 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -175,9 +175,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, symbol_addr = 0; symname = strtab + symtab[symtab_index].st_name; - if (symtab_index && - (ELF32_ST_VISIBILITY(symtab[symtab_index].st_other) - != STV_PROTECTED)) { + if (symtab_index) { symbol_addr = (unsigned long)_dl_find_hash(symname, scope, tpnt, elf_machine_type_class(reloc_type), &tls_tpnt); @@ -190,11 +188,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK)) return 1; } else { - if (symtab_index) - symbol_addr = DL_FIND_HASH_VALUE(tpnt, elf_machine_type_class(reloc_type), - &symtab[symtab_index]); - else - symbol_addr = symtab[symtab_index].st_value; + symbol_addr = symtab[symtab_index].st_value; tls_tpnt = tpnt; } -- cgit v1.2.3 From aaf4cbd98fda76af93ebea5241f65291ff6bcaac Mon Sep 17 00:00:00 2001 From: Salvatore Cro Date: Wed, 12 Jan 2011 10:27:16 +0100 Subject: 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 Signed-off-by: Carmelo Amoroso --- ldso/ldso/i386/elfinterp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ldso/ldso/i386') diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index a01c1d020..0017c239b 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -168,16 +168,19 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, #if defined (__SUPPORT_LD_DEBUG__) unsigned long old_val; #endif + struct symbol_ref sym_ref; reloc_addr = (unsigned long *)(intptr_t)(tpnt->loadaddr + (unsigned long)rpnt->r_offset); reloc_type = ELF32_R_TYPE(rpnt->r_info); symtab_index = ELF32_R_SYM(rpnt->r_info); symbol_addr = 0; + sym_ref.sym = &symtab[symtab_index]; + sym_ref.tpnt = NULL; symname = strtab + symtab[symtab_index].st_name; if (symtab_index) { symbol_addr = (unsigned long)_dl_find_hash(symname, scope, tpnt, - elf_machine_type_class(reloc_type), &tls_tpnt); + elf_machine_type_class(reloc_type), &sym_ref); /* * We want to allow undefined references to weak symbols - this @@ -187,6 +190,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, if (unlikely(!symbol_addr && (ELF_ST_TYPE(symtab[symtab_index].st_info) != STT_TLS) && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK)) return 1; + tls_tpnt = sym_ref.tpnt; } else { symbol_addr = symtab[symtab_index].st_value; tls_tpnt = tpnt; -- cgit v1.2.3