Age | Commit message (Collapse) | Author |
|
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>
|
|
This is a post merge fix to address build issue when PRELINK
support is enabled.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
* origin/master: (61 commits)
fts: fix warning due to old-style function definition
ldso_tls: fix compiler warning due to missing cast
resolv: fix bug in res_init with ipv6 nameservers
config: Fix passing defconfig args
buildsys: pt-initfini.s depends on uClibc_config.h
libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym()
resolv: try next server on SERVFAIL
getaddrinfo: allow numeric service without any hints
bump version to 0.9.33-git
nptl/pthread: Correct path for machine specific pt-initfini.c
ctor/dtor nptl: Fix init and fini function compilation
Rules.mak: Rearrange appending UCLIBC_EXTRA_CFLAGS to CFLAGS
ARM: remove EABI/OABI selection
ARM: detect BX availibility at build time
ARM: #include <bits/arm_asm.h> where __USE_BX__ is used
ARM: transform the EABI/OABI choice into a boolean
ARM: remove sub-arch/variants selection from menuconfig
ARM: introduce blind options to select & force THUMB mode
ARM: reorder "Use BX" option
Fix __libc_epoll_pwait compile failure on x86
...
Conflicts:
ldso/libdl/libdl.c
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Fix compiler warning (as below) due to missign cast
In file included from ldso/ldso/ldso.c:42:0:
ldso/ldso/dl-tls.c: In function 'init_tls':
ldso/ldso/dl-tls.c:1028:24: error: initialization makes pointer from integer without a cast
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
On FDPIC platforms, functions are passed by function descriptor, not by
pointers. If you don't specify ELF_RTYPE_CLASS_DLSYM when calling
_dl_find_hash() the return value from dlsym() will be a pointer not a
function descriptor, crashing the program.
The bug was introduced when TLS support was added in
534661b91c98492995274c364c8177c45efc63db
Closes bug#3433
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The check for __USE_BX__ will be available in bits/arm_asm.h,
so the latter must be included wherever the former is used.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
From: Alan Davis <adavis@ti.com>
On C6X, when trying to execute a program that has a textrel DSO, it
fails to load. The telltale line in the LD_DEBUG output is:
_dl_get_ready_to_run:779: file=''; needed by './a.out'
The corresponding DT_NEEDED entry has 'libc.so.0', but here the
filename is empty. This is what is happening in
_dl_elf_shared_library():
First, map all segments according to their permissions. Text gets
initially mapped read-only.
Then, parse the dynamic information. The dynamic table is in RW but
some of the tags may point to RO. For example, DT_NEEDED points to a
string in .dynstr which is in RO. These pointers get computed
according to the loadmap from the original mapping.
Then, in response to a DT_TEXTREL tag, the RO segment gets remapped,
thereby invaliding anything that points to it, in particular certain
dynamic tags such as DT_NEEDED.
The following patch re-parses the dynamic info after the remapping so
as to re-compute any invalid pointers.
Signed-off-by: Alan Davis <adavis@ti.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Fix dladdr to correctly handle local function's address so backtrace_symbols
print only the function address for these function, instead of showing the name
of nearest one.
Indeed the dladdr walk through the hash table to find the nearest symbol, that
doesn't contain local symbols.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
* origin/master: (32 commits)
libubacktrace: fix backtrace support on arm-eabi, which needs libgcc_eh linked too
getaddrinfo.c: fix incorrect check for ERANGE from gethostbyaddr_r
getaddrinfo.c: improve code readability. No functional changes
string: remove unused variable
x86_64: silence warning if !TLS
buildsys: prettify ssp.c handling
madvise is LINUX_SPECIFIC
test_nptl: fix expected result for tst-cputimer[123]
test_nptl: fix expected result for tst-clock2 test
buildsys: make $(LOCAL_INSTALL_PATH) phony
ether_aton: reject invalid input
tests: disable ether tests if !HAS_SOCKET
inet: add ether_aton testcase
sysconf: clock_getres depends on HAS_REALTIME
__rt_sigwaitinfo: depends on HAS_REALTIME
buildsys: minor fixes in Makefile.arch for C6X
buildsys: minor fixes in Makefile.arch for microblaze
libubacktrace: enabled for all archs indeed.
sparc: don't access fp registers when configured for no fpu
libubacktrace: generic implementation based dwarf
...
Conflicts:
ldso/ldso/dl-elf.c
ldso/ldso/mips/elfinterp.c
ldso/ldso/x86_64/elfinterp.c
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
TODO: fix all other arches
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
symbols
_dl_find_hash() relies on sym_ref parameter to check if the looked-up symbol
is protected. The code fixes a case when _dl_perform_mips_global_got_relocations()
was calling _dl_find_hash() without providing sym_ref parameter.
The bug was causing hangs if a library exporting non-protected symbol was earlier in
link order than library with the same symbol declared as protected.
Signed-off-by: Maksim Rayskiy <mrayskiy@broadcom.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
For DSBT targets (C6X only at this point), we'd like to support the case
where the user did not specify --dsbt-index at link time when building a
shared library. The dynamic linker can still assign an index at runtime
and fix up the DSBT_INDEX relocs, at the cost of startup time and memory
space.
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
|
|
We have a problem with DT_TEXTREL shared libraries on nommu machines.
The dynamic linker's strategy is to map the text segment read-only
first, then look for DT_TEXTREL, and use mprotect to change protections
if necessary. This fails on nommu, since a nommu kernel can decide to
share the memory for private read-only file mappings, and mprotect
doesn't (can't) do anything about this sharing. Existing nommu targets
apparently have no need for this, but on C6X, we may need to assign
library indices at run-time if no --dsbt-index option was passed to the
linker at build time.
Hence, the following patch, which instead of using mprotect, redoes the
mapping with PF_W set.
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
|
|
* origin/master: (137 commits)
utils/ldd: Check for returned pointer from strrchr not the value it holds
cris: add provide arch-specific vfork implementation
lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined
bump version to 0.9.32-rc3-git
release 0.9.32-rc3
memalign: include sys/param.h for MAX
arm/bits/atomic.h: Include common/bit/atomic.h for thumb1
wctype.h: fix libc_hidden_proto for iswupper and add it for iswspace
add libc_hidden_proto for wcs[n]casecmp_l
really fix missing __libc_drand48_data
Revert "missing prototype of __libc_drand48_data fixed"
missing prototype of __libc_drand48_data fixed
time.c, time.h: remove unused hidden strftime/strptime
nanosleep.c: remove duplicated libc_hidden_proto
ctype.c, ctype.h: remove commented parts that were banned for removal after 0.9.31
_wctype.c, wctype.h: remove unused isw* and wctype_l hidden functions
time.c, wchar.h: remove unused hidden wcsftime
str[n]casecmp.c: fix hidden usage
remove unused hidden functions
frv/memset.S: add missing libc_hidden_def
...
Conflicts:
ldso/ldso/ldso.c
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
|
|
Use ADDR_ALIGN to align the minvma when loading shared libraries instead
of the hard coded 0xffffU value.
This fixes teh stand/alone support on ARM as reported in bug #3133.
Signed-off-by: Sven Ola <sven-ola@gmx.de>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
(cherry picked from commit 435471db8561e4686e5921b7f719ab6d5a0d06f7)
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
This adds some DSBT index sanity checks to the runtime linker. It
catches libraries which have no index (index 0) and libraries which
try to use an already used index.
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
|
|
This adds support for the TI C6X family of processors.
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
|
|
This adds support for DSBT ELF to ld.so. This uses loadmaps like FD-PIC.
Some code is added in ld.so to initialize the DSBT tables, and there's
also a new target macro FINISH_BOOTSTRAP_RELOC.
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
|
|
This adds support for a new binary format, DSBT ELF, to the Makefiles.
Every shared library is assigned a DSBT index, and the link.so macro is
adjusted to ensure the correct linker argument is passed.
Configuration and ldso support will follow in separate commits.
Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Avoid using strong_alias in ssp, some archs dislike it.
Make stack_chk_guard static.
Export __stack_smash_handler only if compatibility option is enabled.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
|
|
Initialize tls_tpnt to NULL on all archs instead of 0.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
|
|
Use ADDR_ALIGN to align the minvma when loading shared libraries instead
of the hard coded 0xffffU value.
This fixes teh stand/alone support on ARM as reported in bug #3133.
Signed-off-by: Sven Ola <sven-ola@gmx.de>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
Commit 33cb7f0b4 tried to add a small optimization for skipping unnecessary
.dynamic adjustments, but did so by referencing an opaque type. While this
works for non-fdpic targets (since the type can be cast to an integer), it
falls apart for fdpic targets where the type is actually a structure.
Since FDPIC can't support this optimization without walking a series of
linked structures, just skip it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|