summaryrefslogtreecommitdiffstats
path: root/ldso
Commit message (Collapse)AuthorAgeFilesLines
* ldso: get rid of _dl_lookup_hashCarmelo Amoroso2011-01-203-11/+5
| | | | | | | | Now _dl_find_hash and _dl_lookup_hash are exactly the same, we can get rid of the _dl_lookup_hash, reverting the _dl_find_hash from a wrapper of _dl_lookup_hash to its original role. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* Add protected symbols support for all architecturesSalvatore Cro2011-01-2016-89/+131
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Revert "ldso/arm: Correct protected symbol resolution"Carmelo Amoroso2011-01-201-9/+2
| | | | | | | | This reverts commit 48fb264beaac8114e5ac3e80e70dda473fbce96d. 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 <carmelo.amoroso@st.com>
* Revert "ldso_sh: add support for protected symbols to SH"Carmelo Amoroso2011-01-201-24/+18
| | | | | | | | This reverts commit 74407db52d3953c7f3c6b8a53661cfc96cb07e22. 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 <carmelo.amoroso@st.com>
* Revert "ldso/i386: support protected symbols"Carmelo Amoroso2011-01-201-8/+2
| | | | | | | | 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 <carmelo.amoroso@st.com>
* Revert "ldso: silence warning about unused tls var if !tls"Bernhard Reutner-Fischer2010-11-241-2/+0
| | | | | | This reverts commit 23fa805150d573a913cad69d34c06f3b2ce54270. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* ldso: silence warning about unused tls var if !tlsBernhard Reutner-Fischer2010-11-241-0/+2
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* ldso/include/dl-hash.h: suppress compiler warning. no code changesDenys Vlasenko2010-11-021-6/+6
| | | | | | | | | | The warning was repeated for every .c file which is including this header: ./ldso/include/dl-hash.h: In function '_dl_find_hash': ./ldso/include/dl-hash.h:150: warning: unused parameter 'tpntp' Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ldso_sh: add support for protected symbols to SHSalvatore Cro2010-09-241-18/+24
| | | | | | | | | | Protected symbols should not be overridden by symbols from other modules. Such symbols are exported i.e. globally visible, but references from whithin defining modules are satisfied locally. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* ldso: Do not adjust dynamic section entries unnecessarilyFilippo Arcidiacono2010-09-151-7/+10
| | | | | Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* ldso: Fix compilation for x86_64 without TLS support.Will Newton2010-09-071-0/+2
| | | | | | | Add an #ifdef to avoid using TLS structures when TLS is not enabled. Signed-off-by: Will Newton <will.newton@imgtec.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* silence warning about incompatible types with _dl_init_static_tlsBernhard Reutner-Fischer2010-07-273-3/+2
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* ldso: Fix DL_BOOT_COMPUTE_DYN macroFilippo Arcidiacono2010-07-261-1/+1
| | | | | Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* ldso/arm: Correct protected symbol resolutionKhem Raj2010-07-211-2/+9
| | | | | | | * Protected symbols should not be overridden with symbols from other modules. Signed-off-by: Khem Raj <raj.khem@gmail.com>
* ldso/mips: pltgot should array not address of array to dynamic info.Khem Raj2010-07-191-1/+1
| | | | | | | | * This change was introduced in commit 9381d622e2411a35a5fd73a5a573eb269e2dd9c9 which rendered uclibc not booting on mips targets. Restoring it makes it work again. Signed-off-by: Khem Raj <raj.khem@gmail.com>
* nptl: fix buildsysBernhard Reutner-Fischer2010-07-061-1/+1
| | | | | | | | | Now automatically picks the correct (arch and subarch specific) impls in favour of generic impls. make O=/tmp/objs PREFIX=/my/sysroot -j works now as expected (both out-of-tree as well as parallel-safe). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* get rid of needless c99 constructAustin Foxley2010-06-211-2/+2
| | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* ldso/mips: Fix relocation parsing so that they work on both mips32/mips64Khem Raj2010-06-021-2/+2
| | | | | Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Rob Landley <rob@landley.net>
* powerpc: Add TLS and NPTL supportKhem Raj2010-05-093-16/+45
| | | | | Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* ldso: fix x86_64 R_X86_64_TPOFF64 and R_X86_64_DTPOFF64 relocationsRoman I Khimov2010-05-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | R_X86_64_TPOFF64 revealed by trivial testcase: =================================================================== #include <stdio.h> #include <errno.h> int main() { void *a = &errno; printf("errno addr: %llx\n", a); __asm__("movq errno@gottpoff(%%rip), %0;\n" "add %%fs:0x0,%0;" : "=r"(a) ); printf("got errno addr: %llx\n", a); return 0; } =================================================================== The addresses application got with R_X86_64_TPOFF64 was different than the once libc internal __errno_location returned. R_X86_64_DTPOFF64 testcase is even simpler than that: =================================================================== #include <stdio.h> #include <errno.h> #include <netdb.h> #undef h_errno extern __thread int h_errno; int main() { printf("h_errno addr: %llx\n", &h_errno); printf("__h_errno_location addr: %llx\n", __h_errno_location()); return 0; } =================================================================== but needs to be linked with "-lpthread". This way we've got h_errno relocation via R_X86_64_TPOFF64 in application and h_errno relocation via R_X86_64_DTPOFF64 in libpthread which has its own __h_errno_location() (probably we can kill it later?). And addresses were different again. The problem is that both relocations resolve symbols in external modules and thus should use symbol_addr instead of sym->st_value. Signed-off-by: Roman I Khimov <khimov@altell.ru> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* include dlfcn.h in ldso.h to get RTLD_NODELETE definitionAustin Foxley2010-04-281-0/+1
| | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* ldso: support RTLD_NODELETE and DF_1_NODELETETimo Teräs2010-04-223-13/+22
| | | | | | | | | Honor the nodelete flags so we don't delete shared library if it's sticky. This is useful for libpthread if it gets pulled in by a dlopen'ed library. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* nptl: proper soname handlingNatanael Copa2010-04-222-4/+4
| | | | | | | | | | | Since sublevel releases are not ABI compatible we need to adjust the soname to include the sublevel version. This makes it possible to install ABI incompatible versions of the library side by side so clean upgrades are possible. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* ldso/i386: support protected symbolsJoakim Tjernlund2010-04-161-2/+8
| | | | | | | | Make sure protected symbols are not overridden by other modules. Signed-off-by: Joakim Tjernlund <joakim.tjernlund@transmode.se> Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* Merge commit 'origin/master' into nptlAustin Foxley2010-04-141-0/+8
|\ | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * ldso: Add config option for controlling LD_PRELOADCarmelo AMOROSO2010-04-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | On hardened system it could be useful to disable the use of LD_PRELOAD environment variable for preloading shared objects before the system libraries. So this patch add a config option, LDSO_PRELOAD_ENV_SUPPORT, to control this behaviour. It is enabled by default. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | silence debug warningBernhard Reutner-Fischer2010-04-121-2/+6
| | | | | | | | | | | | variable 'tmp' set but not used Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | whitespace cleanupBernhard Reutner-Fischer2010-04-121-5/+5
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | Merge remote branch 'origin/master' into nptlAustin Foxley2010-04-126-13/+6
|\| | | | | | | | | | | | | Conflicts: libc/unistd/confstr.c Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * silence warning about undefined preprocessor tokenBernhard Reutner-Fischer2010-04-125-6/+6
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * ldso_sh: Provide only one definition for elf_machine_type_classCarmelo Amoroso2010-04-111-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It doesn't need to provide different definition of elf_machine_type_class macro depending on TLS support. It also fixes build for sh architecture when thread support is off: CC ldso/ldso/ldso.oS In file included from ./ldso/ldso/sh/dl-sysdep.h:9, from ./ldso/include/dl-string.h:11, from ./ldso/include/ldso.h:40, from ldso/ldso/ldso.c:33: ./include/tls.h:6:22: error: tls.h: No such file or directory make: *** [ldso/ldso/ldso.oS] Error 1 Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* | Merge commit 'origin/master' into nptlAustin Foxley2010-04-022-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile.in extra/Configs/Config.in libc/sysdeps/linux/common/bits/kernel-features.h libc/sysdeps/linux/common/poll.c libc/sysdeps/linux/common/sysdep.h libc/sysdeps/linux/sh/sysdep.h Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * prettify make cleanBernhard Reutner-Fischer2010-03-252-4/+4
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* | x86_64: finish up tls reloc support in ldsoAustin Foxley2010-02-192-8/+28
| | | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | Add missing libgcc_s.h header.Khem Raj2010-02-171-1/+0
| | | | | | | | | | | | * Do not include tls.h in aeabi_read_tp.S. Its not needed. Signed-off-by: Khem Raj <raj.khem@gmail.com>
* | ldso: fix USE_TLS checkAustin Foxley2010-02-111-1/+1
| | | | | | | | | | | | this was causing tls symbols to leak into non-tls builds Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
* | Merge commit 'origin/master' into nptlAustin Foxley2010-02-051-0/+5
|\| | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * ldso: add missing prototypesBernhard Reutner-Fischer2010-02-051-0/+5
| | | | | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * mips/ldso: Check for TLS relocation in elf_machine_type_class.Khem Raj2010-01-252-16/+35
| | | | | | | | | | | | | | * Store the symbol adress received from _dl_find_hash and do not recompute it. Signed-off-by: Khem Raj <raj.khem@gmail.com>
| * ldso: tweak shadow warning with preload file supportBernhard Reutner-Fischer2010-01-211-5/+4
| | | | | | | | | | | | The stat buffer is already declared at the top of the function. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * mips/nptl: Pass correct parameters to dl_find_hash when resolving TLS ↵Khem Raj2010-01-141-6/+14
| | | | | | | | | | | | | | | | | | relocations. Make use of macros from sys/asm.h in crt1.S These two changes are needed for mips nptl to boot once again. Signed-off-by: Khem Raj <raj.khem@gmail.com>
* | mips/ldso: Check for TLS relocation in elf_machine_type_class.Khem Raj2010-01-252-16/+35
| | | | | | | | | | | | | | * Store the symbol adress received from _dl_find_hash and do not recompute it. Signed-off-by: Khem Raj <raj.khem@gmail.com>
* | ldso: tweak shadow warning with preload file supportBernhard Reutner-Fischer2010-01-211-5/+4
| | | | | | | | | | | | | | | | | | The stat buffer is already declared at the top of the function. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> (cherry picked from commit 6140a2a7175a796a7c06119f036357db87a1b865) Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* | mips/nptl: Pass correct parameters to dl_find_hash when resolving TLS ↵Khem Raj2010-01-211-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | relocations. Make use of macros from sys/asm.h in crt1.S These two changes are needed for mips nptl to boot once again. Signed-off-by: Khem Raj <raj.khem@gmail.com> (cherry picked from commit 9c343fd4030dcd7a52616f365893177dded50346) Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* | Merge remote branch 'origin/master' into nptlAustin Foxley2009-12-231-1/+1
|\| | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * Make _dl_dprintf buf non-static to avoid multithreading bugs.Chris Metcalf2009-12-231-1/+1
| | | | | | | | | | Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
| * check if USE_TLS is defined before useHans-Christian Egtvedt2009-12-176-28/+28
| | | | | | | | | | | | | | | | | | | | | | This patch will convert all the #ifdef USE_TLS and #if USE_TLS to #if defined(USE_TLS) && USE_TLS. By checking if the USE_TLS is defined before checking its value will result in correct behavior for architectures not defining this config symbol. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Acked-by: Carmelo AMOROSO <carmelo.amoroso@st.com>
* | check if USE_TLS is defined before useHans-Christian Egtvedt2009-12-176-28/+28
| | | | | | | | | | | | | | | | | | | | | | This patch will convert all the #ifdef USE_TLS and #if USE_TLS to #if defined(USE_TLS) && USE_TLS. By checking if the USE_TLS is defined before checking its value will result in correct behavior for architectures not defining this config symbol. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Acked-by: Carmelo AMOROSO <carmelo.amoroso@st.com>
* | ldso_tls: Refetch dtv from memory if THREAD_DTV has changedCarmelo Amoroso2009-12-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _dl_update_slotinfo might change THREAD_DTV () (if it needs to reallocate it), but the caller (__tls_get_addr) doesn't refetch dtv from memory, it uses its cached copy. This may crash (if dtv[GET_ADDR_MODULE] is off the cliff, or might read uninitialized memory and return it. Typically dtv[GET_ADDR_MODULE].pointer.val is NULL and so __tls_get_addr returns NULL + offset_within_PT_TLS. The next time __tls_get_addr is called for the same library it will return correct address as _dl_update_slotinfo won't need to be called. Signed-off-by: Jakub Jelinek <jakub@redhat.com> Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
* | Merge remote branch 'origin/master' into nptlAustin Foxley2009-11-282-13/+14
|\| | | | | | | Signed-off-by: Austin Foxley <austinf@cetoncorp.com>