Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Conflicts:
ldso/include/dl-hash.h
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
This reverts commit 23fa805150d573a913cad69d34c06f3b2ce54270.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
Update Arch specific part of the dynamic linker to the
latest cahnges required by prelink:
- Use _dl_loaded_modules->scope as global symbol scope
- Pass the sym argument (or NULL) to the _dl_find_hash
- Update _dl_parse, _dl_do_reloc, _dl_do_lazy_reloc and
_dl_parse_relocation_information to reflect the change of
the scope argument's type
- Add the call to _dl_debug_lookup used for trace prelinking.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Conflicts:
ldso/ldso/sh/elfinterp.c
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
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>
|
|
Fixed loadaddr and mappaddr fields to correctly work when prelink
support is enabled.
- loadaddr is an offset relative to the first loadable segment.
- mapaddr is the address where the object has been mapped in memory.
Non PIC library detection fixed too.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Added runtime prelink support to be able to run a prelinked
application; at process startup only the conflicts will be relocated.
This speed up the startup time.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
The dynamic linker was included indifferently at the end of the
loaded modules list. In order to be used with prelink, it is required
to included the ld.so in the local scope of each shared libraries that
depends directly on it.
Also it is included in the global scope at the first occurrence.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Added support for the following tracing capabilities:
- LD_WARN to warn about undefined symbols during the lookup stage.
- LD_TRACE_PRELINKING to trace the needed libraries of the object
that we are prelinking.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Global symbol scope is implemented as a linked list of
local scope, that dynamically grows and shrinks when dlopen/
dlclose are called. Each local scope is implemented as an array
of pointer to struct elf_resolve.
This will help to detect conflict when LD_TRACE_PRELINKING option
will be implemented.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
The dynamic linker can be run either indirectly through running some
dynamically linked program or library (in which case no command line options
to the dynamic linker can be passed and, in the ELF case, the dynamic linker
which is stored in the .interp section of the program is executed)
or directly by running:
/lib/ld-uClibc.so.* [OPTIONS] [PROGRAM [ARGUMENTS]]
Stand-alone execution is a prerequisite for adding prelink capabilities
to uClibc dynamic linker, as well useful for testing an updated version
of the dynamic linker without breaking the whole system.
Currently supported option:
--library-path PATH use given PATH instead of content of the environment
variable LD_LIBRARY_PATH
(Mandatory for prelinking)
Not supported options:
--list list all dependencies and how they are resolved
--verify verify that given object really is a dynamically linked
object we can handle
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names
in LIST
This feature can be enabled by setting LDSO_STANDALONE_SUPPORT=y
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
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>
|
|
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>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
* Protected symbols should not be overridden with
symbols from other modules.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
* 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>
|
|
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>
|
|
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Rob Landley <rob@landley.net>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
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>
|
|
variable 'tmp' set but not used
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Conflicts:
libc/unistd/confstr.c
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
* Do not include tls.h in aeabi_read_tp.S. Its not needed.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
this was causing tls symbols to leak into non-tls builds
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
* Store the symbol adress received from _dl_find_hash
and do not recompute it.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
* Store the symbol adress received from _dl_find_hash
and do not recompute it.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
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>
|