Age | Commit message (Collapse) | Author |
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
as per comment in the file.
Fixes runtime with __THUMB_INTERWORK__ enabled.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
There's no need to export this symbol, so mark them all hidden.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
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>
|
|
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>
|
|
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>
|
|
The tpnt field is already set, so not needed to assign it again.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
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>
|
|
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
The setup logic is duplicated, so unify it in a local func.
Mark the variable const while we're doing this, and add missing
ifdef protection to the header that declares it availability.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
This implements big-dlfcn lock to allow multithreaded usage of
dlopen/dlsym/dlclose. We should really clean up the dl code so
we can use more fine grained locking or even RCU where appropriate.
But at least we won't crash now.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
An earlier version had this, but was lost as code was shuffled around.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
The L1 data and L2 code paths duplicate a lot, so unify them.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
There should (hopefully) be no functional changes here.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Much of the logic in the bfin/frv subdirs is FDPIC specific and not arch
specific. So start a new fdpic/ subdir to keep common things.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
The former is part of a standard (C99) while the latter is not.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Fix size parameter when unmap a library by means of dlclose, by
taking into account the p_vaddr of first PT_LOAD segment, so it works
also for prelinked shared objects.
Unmapping of dlopen shared libraries is broken since
94cc6edb78a12655c0602a246fa1cbdc8c6d0ad9
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
So application query if specified module is loaded or not with
dlopen.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
On hardened system it could be useful to disable the use
of LD_LIBRARY_PATH.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Do not defined _dl_ldsopatch if implicit search path if not enabled,
and avoid to call search_for_named_library (even if it is able to handle
NULL search path).
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Honour LDSO_SEARCH_INTERP_PATH knob option also when running in
stand-alone mode.
Signed-off-by: Rune <u-uclibc-y2lt@aetey.se>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
A few arches want pread() defined, so move it to common code.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Nowhere do we define DYNAMIC_LOADER_IN_SIMULATOR, so drop the little bit
of code that depends on it. At least in the Blackfin case, we can run an
FDPIC ldso just fine under the simulator without hacks.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
microblaze can either be with mmu or without
If with, use elf rather than flat, and support shared libs
Signed-off-by: Ryan Flux <ryan.flux@emsolutions.com.au>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
gcc informed me:
In file included from ldso/ldso/ldso.c:46:0:
ldso/ldso/x86_64/elfinterp.c: In function '_dl_do_lazy_reloc':
ldso/ldso/x86_64/elfinterp.c:294:6: warning:
variable 'symtab_index' set but not used [-Wunused-but-set-variable]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Trivial fixes for these warnings:
CC ldso/libdl/libdl.oS
In file included from ldso/ldso/ldso.c:46:0:
ldso/ldso/mips/elfinterp.c:88:1: warning: no previous prototype for '__dl_runtime_pltresolve'
ldso/ldso/ldso.c: In function '_dl_get_ready_to_run':
ldso/ldso/ldso.c:475:5: warning: assignment makes pointer from integer without a cast
In file included from ldso/ldso/ldso.c:1097:0:
ldso/ldso/dl-elf.c: In function '_dl_load_elf_shared_library':
ldso/ldso/dl-elf.c:811:3: warning: assignment makes pointer from integer without a cast
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
check_match() relies on checking for (sym->st_value == 0) to see if the
symbol is undefined. This works reasonably well on most architectures,
such as ARM or i386:
$ readelf -s /lib32/libcap.so.2 | grep -E "\<malloc\>"
17: 00000000 0 FUNC GLOBAL DEFAULT UND malloc@GLIBC_2.0 (2)
However, on MIPS, libbfd puts nonzero data in the st_value field to
facilitate resetting the symbol's GOT entry if the library that defines
the symbol gets unloaded:
$ mipsel-linux-readelf -s libfoo.so | grep -E "\<malloc\>"
74: 00003140 0 FUNC GLOBAL DEFAULT UND malloc
This can cause check_match to report a false positive when examining the
external symbol reference. Consequently dlsym() will return a bad pointer
to the caller.
Use the special MIPS logic from glibc-ports-2.13 to avoid this situation.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
_dl_reltypes_tab[] is an array of pointers to constant strings:
Contents of section .data:
20000 01000000 02000000 00000000 00000000 ................
20010 70e50000 7ce50000 88e50000 94e50000 p...|...........
^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^
(pointers are LE)
Contents of section .rodata:
e570 525f4d49 50535f4e 4f4e4500 525f4d49 R_MIPS_NONE.R_MI
e580 50535f31 36000000 525f4d49 50535f33 PS_16...R_MIPS_3
e590 32000000 525f4d49 50535f52 454c3332 2...R_MIPS_REL32
These pointers require relocation:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE *ABS*
0001fffc R_MIPS_REL32 *ABS*
00020010 R_MIPS_REL32 *ABS*
00020014 R_MIPS_REL32 *ABS*
00020018 R_MIPS_REL32 *ABS*
On MIPS, only GOT relocations are currently handled by ldso during
startup. The net effect is that when running with "LD_DEBUG=reloc",
ldso itself crashes before the program even starts. This is caused
by _dl_dprintf() dereferencing an unadjusted string pointer such as
0xe570.
This patch enables the missing relocations and allows LD_DEBUG to work
as designed.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
When debugging memory leaks with Valgrind, it is required that
dynamically loaded shared objects are not unloaded when a process exits,
otherwise symbols from those files aren't correctly resolved in
allocation traces. This patch adds the LDSO_NO_CLEANUP configuration
option to control this behaviour.
Signed-off-by: Richard Braun <rbraun@sceen.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Fix a build error triggered when LDSO_PRELOAD_FILE_SUPPORT is enabled
due to missing definition of 'st' variable.
Signed-off-by: Douglas Mencken <dougmencken@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|