summaryrefslogtreecommitdiff
path: root/ldso
AgeCommit message (Collapse)Author
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>
2012-06-15libdl.c: disable dlinfoPeter S. Mazinger
dlinfo is a GNU extension, it should be of the same type as on glibc. 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: change IS_IN_libdl guard to IS_IN_rtldPeter S. Mazinger
The guard is changed to allow to be used the file in libc as well. Include string.h (although already included by ldso.h). Guard the rest of the file according to config options. 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: use __powerpc__ guard instead of powerpcPeter S. Mazinger
powerpc guard depends on the compiler options, __powerpc__ should work all the time. 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: remove mips related guardPeter S. Mazinger
This can't happen, __mips__ was already checked earlier Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15avr32: common do_rem is good for itPeter 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-15libdl: no need for _dl_strstr in libdl, use strstrPeter 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-15ppc/elfinterp.c: fix comment typosPeter 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-hash.h: remove unused _dl_symbol and unneeded prototypesPeter 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-15libdl.c: hide dl_cleanupPeter 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-elf.h: remove unused prototypePeter 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-15libdl.c,dl-string.h: do not use inlined _dl_memset and others in libdlPeter S. Mazinger
Use the one from libc. While there, remove unused _dl_strncmp() and superfluos static forward declarations. 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 .arm mode for resolver unconditionallyBernhard Reutner-Fischer
as per comment in the file. Fixes runtime with __THUMB_INTERWORK__ enabled. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-13Update C6X supportMark Salter
This patch updates the C6X support to work with latest uClibc code and uses reworked DSBT support to allow using kernel FDPIC loader. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06ldso: preload standard path library with setuid bit setFilippo Arcidiacono
For set-user-ID/set-group-ID ELF binaries, only libraries in the standard search directories that are also set-user-ID must be loaded. This patch fixes existing logic according to the above statement. Furthermore if either library setuid bit isn't set or it cannot be found in the standard search path, the library won't be preloaded but execution go ahead with default one. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06Clean up DSBT supportMark Salter
The existing DSBT support relies on the kernel to provide DSBT info as part of the load maps passed to user space. The problem with this approach is that the DSBT info is in the dynamic section, so the kernel must access a userspace mapping of the dynamic section (or separately read a copy for the kernel) in order to retrieve the information needed by userspace. This patch reworks the DSBT support to remove the reliance on DSBT info coming from the kernel. Instead, ldso reads the info itself from the dynamic section. One other benefit of this is that it allows the existing kernel FDPIC loader to also load DSBT binaries. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-18ldso: sh: handle _dl_skip_args in linker startup instead of __uClibc_mainFilippo Arcidiacono
Handle _dl_skip_args in the asm part of the dynamic linker startup, to skip the ldso arguments, so we can keep this symbol hidden as other archs do. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-04-08ldso: fix fdpic support broken from prelink patchFilippo Arcidiacono
The fdpic support has been broken since the prelink support was added, because it didn't take into account DL_LOADADDR_TYPE could be a different type of ElfW(Addr). Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-29ldso: mark _start hiddenMike Frysinger
There's no need to export this symbol, so mark them all hidden. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-27ldso: bfin: add alias from __start to _startMike Frysinger
On Blackfin systems, we have underscore prefixes in our ABI. So instead of _start, we use __start. However, the makefile explicitly sets _start as the entry point to support toolchains that implicitly use other symbols as the default entry. It's easy enough to add a hidden alias in the Blackfin code for free to support this. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-26ldso: bfin: tweak styleMike Frysinger
No functional changes here. We don't need line continuations as gcc is smart enough to merge the multiple strings for us. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-25ldso: use ELF_xxx()/ElfW() helpersMike Frysinger
They expand into the same code, but using the ELF_xxx()/ElfW() macros makes it much easier to spot similarities between code bases. Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Acked-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-15ldso: remove duplicated assignment with TLS symbolCarmelo Amoroso
The tpnt field is already set, so not needed to assign it again. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-14ldso:sh: fix compiler warning due to unused-but-set-variableCarmelo Amoroso
gcc 4.6.x raises useful warnings due to unused-but-set-variable, This patch fixes the following one by using properly preprocessor guard In file included from ldso/libdl/libdl.c:129:0: ./ldso/ldso/sh/elfinterp.c: In function '_dl_do_reloc': ./ldso/ldso/sh/elfinterp.c:163:22: warning: variable 'tls_tpnt' set but not used [-Wunused-but-set-variable] Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-02-09libdl: fix memleak for local scope of dlopened's needed librariesFilippo Arcidiacono
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-01-27ldso: fix typo in debug messageBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-23ldso/mips: fix symbol lookup for JUMP_SLOT and COPY relocationsCarmelo Amoroso
Fill properly the sym_ref fields when invoking _dl_find_hash to lookup symbols Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-23libdl: fix dlclose handling of symbol scopeCarmelo Amoroso
Defer removal of the local scope of a dl-opened library after all the destructors (of itself and related dependencies) are actually get unloaded, otherwise any function registered via atexit() won't be resolved. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
2012-01-23mips/libdl: Apply relocations after appending the new scopeKhem Raj
Without this the relocations for the current shared object are not resolved since the scope is not added to map yet Signed-off-by: Khem Raj <raj.khem@gmail.com>
2012-01-14buildsys: cache build flags in varsMike Frysinger
Running `make clean` atm takes like 20 seconds because every subdir re-evaluates all the toolchain flags. Add some helpers to automate the process of setting up variables to cache the result of tests, as well as the checking of an already set flag. Now `make clean` takes like 2 seconds on my system. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-02ldso: setup search path even when there are no "/"Mike Frysinger
If people use an interp path such as "ld.so", then there is no "/" found, and we end up dereferencing a NULL pointer. Simplify the logic by having a relative interp path like that be the same as "" (which the code later on interprets as $PWD). While we're here, document some of the nuances of this code. Reported-by: Ignacy Gawędzki <uclibc@qult.net> Signed-off-by: Mike Frysinger <vapier@gentoo.org>