summaryrefslogtreecommitdiff
path: root/ldso/ldso
AgeCommit message (Collapse)Author
2010-06-21get rid of needless c99 constructAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-06-02ldso/mips: Fix relocation parsing so that they work on both mips32/mips64Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Rob Landley <rob@landley.net>
2010-05-09powerpc: Add TLS and NPTL supportKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-05-05ldso: fix x86_64 R_X86_64_TPOFF64 and R_X86_64_DTPOFF64 relocationsRoman I Khimov
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>
2010-04-22ldso: support RTLD_NODELETE and DF_1_NODELETETimo Teräs
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>
2010-04-22nptl: proper soname handlingNatanael Copa
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>
2010-04-16ldso/i386: support protected symbolsJoakim Tjernlund
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>
2010-04-14Merge commit 'origin/master' into nptlAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-14ldso: Add config option for controlling LD_PRELOADCarmelo AMOROSO
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>
2010-04-12silence debug warningBernhard Reutner-Fischer
variable 'tmp' set but not used Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-04-12Merge remote branch 'origin/master' into nptlAustin Foxley
Conflicts: libc/unistd/confstr.c Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-12silence warning about undefined preprocessor tokenBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-04-11ldso_sh: Provide only one definition for elf_machine_type_classCarmelo Amoroso
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>
2010-04-02Merge commit 'origin/master' into nptlAustin Foxley
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>
2010-03-25prettify make cleanBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-02-19x86_64: finish up tls reloc support in ldsoAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-02-17Add missing libgcc_s.h header.Khem Raj
* Do not include tls.h in aeabi_read_tp.S. Its not needed. Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-01-25mips/ldso: Check for TLS relocation in elf_machine_type_class.Khem Raj
* Store the symbol adress received from _dl_find_hash and do not recompute it. Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-01-25mips/ldso: Check for TLS relocation in elf_machine_type_class.Khem Raj
* Store the symbol adress received from _dl_find_hash and do not recompute it. Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-01-21ldso: tweak shadow warning with preload file supportBernhard Reutner-Fischer
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>
2010-01-21mips/nptl: Pass correct parameters to dl_find_hash when resolving TLS ↵Khem Raj
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>
2010-01-21ldso: tweak shadow warning with preload file supportBernhard Reutner-Fischer
The stat buffer is already declared at the top of the function. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-01-14mips/nptl: Pass correct parameters to dl_find_hash when resolving TLS ↵Khem Raj
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>
2009-12-23Merge remote branch 'origin/master' into nptlAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-12-23Make _dl_dprintf buf non-static to avoid multithreading bugs.Chris Metcalf
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-12-17check if USE_TLS is defined before useHans-Christian Egtvedt
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>
2009-12-17check if USE_TLS is defined before useHans-Christian Egtvedt
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>
2009-12-03ldso_tls: Refetch dtv from memory if THREAD_DTV has changedCarmelo Amoroso
_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>
2009-11-28Merge remote branch 'origin/master' into nptlAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-11-27ldso: initialize stack_chk_guard after TLS is initializedNatanael Copa
stack_chk_guard is on thread local storage so we need to init TLS before we can init stack_chk_guard. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-11-25avoid warning about unused variableBernhard Reutner-Fischer
If LDSO_SEARCH_INTERP_PATH is off then ptmp wasn't used. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-11-23nommu: use MAP_UNINITIALIZE for mallocsMike Frysinger
Now that the kernel supports MAP_UNINITIALIZE, have the malloc places use it to get real uninitialized memory on no-mmu systems. This avoids a lot of normally useless overhead involved in zeroing out all of the memory (sometimes multiple times). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-11-22ldso: let people disable the implicit path searchMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-11-15ldso: Add missing newlines to some debug messagesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-16ldso: fixup missed variable rename ( tls_tpnt -> tpntp )Austin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-10-15ldso: simplify handling of extra _dl_lookup_hash() argMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-15ldso: clean up breakage in tls mergeMike Frysinger
The TLS merge 534661b91c9849 introduced multiple style problems as well as random breakage: - missing _dl_free - incomplete parametrization of _dl_lookup_hash - restore FDPIC handling in _dl_lookup_hash Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-14ldso: fixup all the rest of the calls to _dl_find_hashAustin Foxley
With TLS _dl_find_hash grew an extra param. These archs don't have TLS reloc support yet, but they do need to compile without it. Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-10-09check_ld some more flagsBernhard Reutner-Fischer
gold does not currently implement these. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-07ldso: use O_CLOEXEC for cache fileMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-07ldso: use MAP_FAILED with ld.so.cacheMike Frysinger
Rather than use our own custom casted -1 value, just use the MAP_FAILED that common code already sets up for us for mmap(). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-06commentary typo fixBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-06trim whitespaceBernhard Reutner-Fischer
and wrap superlong line. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-04mips: fix typo in elfinterp.cAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-09-26ldso/: tls support for dynamic linkerAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-08-17support building out-of-treeBernhard Reutner-Fischer
Handle O= Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-07-23Blackfin: rename __dl_boot to __startMike Frysinger
The entry symbol is __start rather than __dl_boot. While in the past this was silently ignored, now with common code checking the _start symbol in C code, we end up with link errors: ldso/ldso/ld-uClibc_so.a(ldso.oS): In function `__dl_get_ready_to_run': ldso/ldso/ldso.c:(.text+0x2b30): undefined reference to `__start' collect2: ld returned 1 exit status make[1]: *** [lib/ld-uClibc.so] Error 1 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-23Blackfin: fix incorrect attribute orderMike Frysinger
The order of attributes in a function definition matters and in a few places in the Blackfin code, it was being applied to the return type instead of the function itself. In file included from ldso/ldso/ldso.c:43: ldso/ldso/bfin/elfinterp.c: At top level: ldso/ldso/bfin/elfinterp.c:42: warning: '__visibility__' attribute ignored on non-class types In file included from ldso/ldso/bfin/elfinterp.c:341, from ldso/ldso/ldso.c:43: libc/sysdeps/linux/bfin/crtreloc.c: At top level: libc/sysdeps/linux/bfin/crtreloc.c:91: warning: 'visibility' attribute ignored on non-class types Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-23Blackfin: add elf_machine_load_address() stubMike Frysinger
The Blackfin port never defined elf_machine_load_address() because the one place this code is called never matters to us. But without it, common code likes to hit a build failure, so stub it out. ldso/ldso/dl-startup.c: In function '_dl_start': ldso/ldso/dl-startup.c:170: warning: implicit declaration of function 'elf_machine_load_address' Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-23ldso: fix building for FDPIC systemsMike Frysinger
The force shareable code missed a spot of using the DL_RELOC_ADDR() indirection thus leading to invalid operands: ldso/ldso/ldso.c: In function '_dl_get_ready_to_run': ldso/ldso/ldso.c:409: error: invalid operands to binary + (have 'Elf32_Addr' and 'struct elf32_fdpic_loadaddr') Signed-off-by: Mike Frysinger <vapier@gentoo.org>