summaryrefslogtreecommitdiff
path: root/ldso
AgeCommit message (Collapse)Author
2015-02-20Allow use of executable RUNPATH/RPATH when finding libraries.Steve Ellcey
This option will modify ldso so that it will use the executables RUNPATH/RPATH to find to find libraries even though this behavour is not standard. Setting this option causes the uclibc dynamic linker behavour to match the glibc dynamic linker. Signed-off-by: Steve Ellcey <sellcey@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20ARCv2 ISA supportVineet Gupta
This is next gen Instruction Set Architecture from Synopsys and basis for the ARC HS family of processors. http://www.synopsys.com/dw/ipdir.php?ds=arc-hs38-processor&elq_mid=5732&elq_cid=458802 http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/arc-hs/Pages/default.aspx Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: Conditionalise certain relocations as provided by TLS tools onlyVineet Gupta
uClibc mainline supports NPTL which in turns depends on TLS support in the tools (gcc/binutils), which is yet to be merged in dev branches. However there is some non NPTL code in uClibc, added as part of NPTL effort, which relies on certain relocations only provided by NPTL binutils. As a result building the current upstream even for LT.old breaks. So conditionalize that code on tools, bu tin lack of specific versions, we use NPTL enabling as a sign the tools are equipped to handle those relos. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23xtensa: ldso: drop unused address calculation from _dl_linux_resolveMax Filippov
The result of the calculation in register a12 is never used as the function _dl_linux_resolver only accepts 2 arguments. Drop it. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-23xtensa: ldso: coalesce dl_mprotect address rangesMax Filippov
This noticeably lowers the number of mprotect calls at program startup, e.g. for busybox: 7 calls vs 1835 calls. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16buildsys: fix IS_IN_lib*Bernhard Reutner-Fischer
define NOT_IN_libc / IS_IN_libxxx appropriately to fix pthread_once Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04ldso: Fix compile-error on noMMUBernhard Reutner-Fischer
Thanks to Waldemar Brodkorb for noticing! Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18NPTL: ARC supportVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18ARC: ldso: Use @pcl syntax.Joern Rennecke
Signed-off-by: Joern Rennecke <joern.rennecke@embecosm.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-07-22ARC: ldso: Dont force frame pointer as it useless for unwinding on ARCVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-06-12arm: move check for BX to its own headerYann E. MORIN
As Will noticed, the header this check is currently done in is asm-only, and is not meant to be included from C code. This breaks compilation when compiled for a Thumb2-aware CPU. Move the BX check to its own header, and revert 7a246fd. Reported-by: Will Newton <will.newton@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Will Newton <will.newton@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23ldso: Add remaining relocation types to the tableGregory Fong
The table format is thrown off a bit because some of these names are too long to fit the previous format so they were put on their own lines. Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23ldso/mips: Remove redundant LD_DEBUG printsGregory Fong
These should have been protected by if (_dl_debug_reloc && _dl_debug_detail) , but since the previous change "ldso/mips: actually print results of each relocation" makes this redundant, just eliminate these prints instead. I think this is the only item that is still printing regardless of the value of LD_DEBUG when uClibc is built with SUPPORT_LD_DEBUG=y. Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23ldso/mips: actually print results of each relocationGregory Fong
The patched line was outside of the body of the loop over relocations and so would only print the results of the last relocation, fix that. Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23ldso: Fix misplaced declarationBernhard Reutner-Fischer
Apparently i made a typo when applying 278a06d7abcc8774ba9bb9c15779749c7e2d68cd sorry.. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-08ldso: fix standalone execution on x86_64 architectureCédric VINCENT
If the dynamic linker is built with LDSO_STANDALONE_SUPPORT=y, it can load then run a dynamically linked program when explicitly invoked from the command line. This is used for test and prelink purposes, and also by other tools like PRoot to force the kernel to load the right ELF interpreter. This feature is currently broken on x86_64 since the number of command line arguments (ie. argc) passed from the kernel is an "elf_addr_t" (64 bit on x86_64), whereas it is read as an "unsigned int" (32 bit on x86_64). Ref: https://github.com/cedric-vincent/PRoot/issues/45 Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-01xtensa: add missing .literal_position directivesMax Filippov
This addition allows building uClibc with -mtext-section-literals Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-15ldso: arm, metag: Use runtime pagesizeBernhard Reutner-Fischer
Use the generic runtime pagesize as per ce54b92b046b65464e2d16b3842f3e97e3e0f27e Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: ARC: tweak whitespace some moreBernhard Reutner-Fischer
Use spaces instead of tabs in the table to accomodate different tab settings. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: ARC whitespace tweaksVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: Add ARC supportVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20Fix for SIGBUS error on MIPS64 with N64 ABIWaldemar Brodkorb
When accessing errno, a per thread variable, from _stdio_init a SIGBUS error happens. This change fixes the wrong relocation and debug output. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: use unlikely macroBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-12ldso: silence warnings in debug codeBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06ldso: remove duplicate function declarationsBaruch Siach
Commit e3dec33ba (powerpc: Add TLS and NPTL support) introduced a duplicate of _dl_add_to_slotinfo and _dl_initial_error_catch_tsd declarations. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06libdl: fix unused variable warningBaruch Siach
The following warning introduced with commit 231e4a9b4 (libdl: fix dlopen implementation from statically linked application): ldso/libdl/libdl.c: In function 'do_dlopen': ldso/libdl/libdl.c:311:23: warning: unused variable 'ls' [-Wunused-variable] Cc: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06ldso: fix unused variable warningBaruch Siach
This fixes the following warning when SUPPORT_LD_DEBUG_EARLY is not enabled: ldso/ldso/ldso.c: In function '_dl_get_ready_to_run': ldso/ldso/ldso.c:754:16: warning: unused variable 'tmp' [-Wunused-variable] This was introduced with commit 94cc6edb (ldso: Rework global scope handling and symbol lookup mechanism). Cc: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-07ldso/libdl: Also include dl-tls.h for for !SHARED.Gregory Fong
On MIPS, several relocations that were original only resolved by the dynamic linker were reused as static relocations. Consequently the macros TLS_DTPREL_VALUE and TLS_TPREL_VALUE defined in libpthread/nptl/sysdeps/mips/dl-tls.h need to be available even for !SHARED. Relevant: http://www.linux-mips.org/wiki/NPTL#History Original patch by Vincent Wen <wenvincent@gmail.com>: http://lists.uclibc.org/pipermail/uclibc/2013-April/047707.html When build statically linked applications for MIPS platform, sometimes the linker fails with following errors: undefined reference to TLS_DTPREL_VALUE undefined reference to TLS_TPREL_VALUE The include of dl-tls.h is only in code guarded by SHARED, Removing the SHARED compilation option to cover static link too. Signed-off-by: Vincent Wen <wenvincent90@gmail.com> Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-05-13libdl: fix dlopen implementation from statically linked applicationFilippo Arcidiacono
Calling dlopen from statically linked application is actually broken, because _dl_find_hash enters into an infinite loop when trying to resolve symbols. In this case it doesn't need to extend the global scope, it is readyto be used as it is, because _dl_loaded_modules already points to the dlopened library. The patch also fixesi a typo in __LDSO_LD_LIBRARY_PATH__ macro, that was preventing to get the actual value of the LD_LIBRARY_PATH. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-05-13libc: deal with aux vect inside __uClibc_main only if !SHAREDFilippo ARCIDIACONO
It's not safe to use the aux vect inside __uClibc_main if we are running with shared libraries, because it could have been already modified. For example, if some constructor plays with environment variables by using unsetenv, the modifications done into the stack to unset an environment variable, have impacts on the aux vect due to the extra NULL entries added. Due to this, __uClibc_main is not able to detect where the aux vect starts, so all the entries that are used by __uClibc_main (AT_UID, AT_EUID, AT_GID, AT_EGID, AT_PAGESZ and possibly other arch specific) are impacted. Same side effect on the aux vect is caused by the ld.so when running a SUID program with some of the unsecure environment variables set, that will be unset by the ld.so itself. In order to fix this issue, it needs to handle aux vect entries into __uClibc_main only if SHARED is not defined. In SHARED case, libc refers to __dl_secure and _dl_pagesize as initialised by the ld.so where the aux vext is still untouched. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Reviewed-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2013-03-22Fix some fragileness in dlopen/do_dlopen wrapper & worker pair.Nathan Sidwell
do_dlopen contains __builtin_return_address to determine from whence it was called, and uses that to determine which dynamic object's data it should use to start the search. (In the bug I was tracking, this related to whether the application's RPATH was used or not.) For that to work, it has to have been inlined into the wrapper function. As it happens, it wasn't being inlined. That's an unfortunate compiler behaviour, but it isn't wrong and shouldn't have caused dlopen to fail. This patch changes things so the wrapper function determines the return address, and passes it to the worker. If the worker's inlined, the generated code should be exactly the same as before. Signed-off-by: Nathan Sidwell <nathan@codesourcery.com> Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2013-03-14metag: Add NPTL supportMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14metag: Add support for loading shared objects into core memories.Markos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14Add support for the Meta architectureMarkos Chandras
Meta cores are 32-bit, hardware multithreaded, general purpose, embedded processors which also feature a DSP instruction set, and can be found in many digital radios. They are capable of running different operating systems on different hardware threads, for example a digital radio might run RTOSes for DAB decoding and audio decoding on 3 hardware threads, and run Linux on the 4th hardware thread to manage the user interface, networking etc. HTPs are also capable of running SMP Linux on multiple hardware threads. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14ldso: Fix Build warnings with common-generic ABI buildVineet Gupta
CC ldso/ldso/ldso.oS In file included from ./ldso/include/ldso.h:47, from ldso/ldso/ldso.c:33: ./ldso/include/dl-syscall.h:35:1: warning: "S_ISUID" redefined In file included from ./include/bits/kernel_stat.h:10, from ./ldso/include/dl-syscall.h:31, from ./ldso/include/ldso.h:47, from ldso/ldso/ldso.c:33: ./include/sys/stat.h:163:1: warning: this is the location of the previous definition In file included from ./ldso/include/ldso.h:47, from ldso/ldso/ldso.c:33: ./ldso/include/dl-syscall.h:36:1: warning: "S_ISGID" redefined In file included from ./include/bits/kernel_stat.h:10, from ./ldso/include/dl-syscall.h:31, from ./ldso/include/ldso.h:47, from ldso/ldso/ldso.c:33: ./include/sys/stat.h:164:1: warning: this is the location of the previous definition ----------------------------------------------------------------- Cleanly seperated the legacy ABI vs. new ABI scenario. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-07buildsys: Add missing $(SYMBOL_PREFIX) to symbol namesMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20ldso: Use newer syscalls if arch does not have the deprecated syscallsMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05mman: rename MAP_UNINITIALIZE to MAP_UNINITIALIZEDBernhard Reutner-Fischer
The name was changed to include a trailing 'D' when it went into the kernel. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-09dl: fix dlsym lookups with RTLD_NEXTTimo Teräs
The current code for dlsym() when invoked with RTLD_NEXT lookup searches for the module where it's being called from, and executes the _dl_find_hash only for the next module in the chain. However, if the looked symbol is not there, the rest of the modules are not checked. Generally this is not a problem as symbols are merged for the parent modules; so this affects only RTLD_NEXT. This patch adds a loop iterating through all the following modules. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Reviewed-by: Filippo ARCIDIACONO <filippo.arcidiacono@st.com> Tested-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
This drops __signed, __volatile, and __const. Only the latter was used in the code base, and for uClibc, not consistently. Much of the code used plain "const" which meant "__const" was useless. Really, the point of this is to stay in sync with what glibc did. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18ldso: include dlfcn.h for RTLD_NODELETEMike Frysinger
Building with NPTL enabled and shared library support disabled we hit: In file included from libpthread/nptl/sysdeps/generic/dl-tls.c:30:0: ./ldso/include/dl-elf.h: In function '__dl_parse_dynamic_info': ./ldso/include/dl-elf.h:173:20: error: 'RTLD_NODELETE' undeclared (first use in this function) ./ldso/include/dl-elf.h:173:20: note: each undeclared identifier is reported only once for each function it appears in make: *** [libpthread/nptl/sysdeps/generic/dl-tls.os] Error 1 A previous commit (f26c5f6952ce9bf8edec9c1571c47addb1bcc442) touched on a similar issue, but added the include to the incorrect location. Reported-by: Christophe Lyon <christophe.lyon@st.com> [arm nommu] Reported-by: Daniel Beecham <daniel@lunix.se> [static x86_64] Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-15add LDSO_SAFE_RUNPATH config optionPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15dl-defs.h: avoid including dl-sysdep.h if compiling hostutilsPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15mips/README: fix comment about file from which functions were copiedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15ldso: use _dl_strdup and _dl_dprintf only in ld-uClibc.soPeter S. Mazinger
Add support for %p to _dl_dprintf for later corrections in debug messages. Disable _dl_debug_file if LD debugging is not enabled and change it's use to 2. The use of dprintf in elfinterp.c will spit out warnings, will be fixed in the reworked ldso. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15dl-string.h: include dl-defs.h instead of dl-sysdep.hPeter S. Mazinger
Include stddef.h instead of defining NULL Adapt guard to file name. Reorder includes a bit. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15dl-defs.h: include dl-sysdep.h before fallbacks.Peter S. Mazinger
dl-sysdep.h has to come before the fallbacks in dl-defs.h, else the wrong macros are used. While there adapt the guard to the file name. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15dl-elf.h: add some includes and fix commentsPeter S. Mazinger
While there change the guard of the file Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15ldso/include: change guard of headers to reflect the file names.Peter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>