summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-startup.c
AgeCommit message (Collapse)Author
2024-04-18Fix vDSO support for all supported architectures.Dmitry Chestnykh
- Cleanup dl-vdso.c code. - Pass `void *` as first arg to `load_vdso()`, using 32-bit type is completely wrong on 64bit architectures. - Split libc code and vDSO-related code. Move arch-specific implementations into separate files. The performance improvement is for example 50-60 times on ARMv7 and about 4 times on x86_64. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-20fix c6x toolchain compileWaldemar Brodkorb
2024-02-07ld.so: Add support of DT_RELR relocation format.Dmitry Chestnykh
Nowadays modern libcs like Glibc and musl currently support processing of RELATIVE relocations compressed with DT_RELR format. However I have noticed that uClibc-ng doesn't support this feature and if the source will be linked with `-Wl,-z,pack-relative-relos` (bfd) or `-Wl,--pack-dyn-relocs=relr` (lld) then ld.so cannot properly load the produced DSO. This patch is intended to fix this issue and adds applying of DT_RELR relative relocation. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2023-08-14add vsdo supportlordrasmus
2022-12-19add getauxval() implementationramin
2022-09-21ldso: clean up PERFORM_BOOTSTRAP_GOT ifdeferryMax Filippov
3 architectures currently define PERFORM_BOOTSTRAP_GOT: avr32, mips and xtensa. A block of code that applies relative relocations in the DL_START is disabled when PERFORM_BOOTSTRAP_GOT is defined, unless it's avr32 or mips, effectively disabling it only for xtensa. This may be simplified by removing the call to elf_machine_relative from the xtensa PERFORM_BOOTSTRAP_GOT and always using common code. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2020-09-22Fix unused variable warning in dl-startup.cYann Sionneau
SEND_STDERR_DEBUG does nothing if __SUPPORT_LD_DEBUG_EARLY__ is not defined thus causing a warning. Fixes this: In file included from ldso/ldso/ldso.c:86:0: ldso/ldso/dl-startup.c: In function '_dl_start': ldso/ldso/dl-startup.c:313:13: warning: variable 'strtab' set but not used [-Wunused-but-set-variable] char *strtab; ^~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2017-06-21remove editor hints for viWaldemar Brodkorb
2017-04-01nios2: allow to hack on experimenting ld.so supportWaldemar Brodkorb
2016-10-31ldso: remove useless debug output, too much noiseWaldemar Brodkorb
2015-02-27ldso: silence warningBernhard Reutner-Fischer
In file included from ldso/ldso/ldso.c:87:0: ldso/ldso/dl-startup.c: In function '_dl_start': ldso/ldso/dl-startup.c:184:32: warning: cast from pointer to integer of differennt size [-Wpointer-to-int-cast] auxvt[AT_BASE].a_un.a_val = (Elf32_Addr) &_begin; Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.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>
2011-07-27ldso/mips: Enable bootstrap relocationsKevin Cernekee
_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>
2011-05-04Merge remote-tracking branch 'origin/master' into prelinkCarmelo Amoroso
* 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>
2011-04-18dl-startup: fix typos in block commentKevin Cernekee
Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17ldso: Add runtime prelink supportFilippo Arcidiacono
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>
2010-09-17ldso: Rework global scope handling and symbol lookup mechanismFilippo Arcidiacono
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>
2010-09-17ldso: Add implementation of ld.so standalone executionFilippo Arcidiacono
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>
2009-12-17check if USE_TLS is defined before useHans-Christian Egtvedt
This patch will convert all the #ifdef USE_TLS and #if USE_TLS to #if defined(USE_TLS) && USE_TLS. By checking if the USE_TLS is defined before checking its value will result in correct behavior for architectures not defining this config symbol. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Acked-by: Carmelo AMOROSO <carmelo.amoroso@st.com>
2009-10-15ldso: clean up breakage in tls mergeMike Frysinger
The TLS merge 534661b91c9849 introduced multiple style problems as well as random breakage: - missing _dl_free - incomplete parametrization of _dl_lookup_hash - restore FDPIC handling in _dl_lookup_hash Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-09-26ldso/: tls support for dynamic linkerAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-07-05Avoid type-punned pointers that break strict-aliasingRon
Signed-off-by: Ron Lee <ron@debian.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-01-14ldso: performs bootstrap relocations only if required by the arch.Carmelo Amoroso
It is controlled by ARCH_NEEDS_BOOTSTRAP_RELOCS macro. Signed-off-by: Jirka <olsajiri@gmail.com> Acked-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2009-01-10simple optimizations and style fixes in dynamic loadingDenis Vlasenko
text data bss dec hex filename - 16709 240 92 17041 4291 lib/ld-uClibc.so + 16634 236 92 16962 4242 lib/ld-uClibc.so - 4602 344 4 4950 1356 lib/libdl-0.9.30-svn.so + 4571 328 4 4903 1327 lib/libdl-0.9.30-svn.so - 4602 344 4 4950 1356 lib/libdl.so + 4571 328 4 4903 1327 lib/libdl.so
2009-01-04ldso/ldso/dl-startup.c: make _dl_elf_main static; remove one dead variable.Denis Vlasenko
ldso/ldso/avr32/dl-startup.h: remove superfluous definition of START() macro. ldso/ldso/*/dl-startup.h: fix a typo in comment text data bss dec hex filename - 16752 244 92 17088 42c0 lib/ld-uClibc.so + 16709 240 92 17041 4291 lib/ld-uClibc.so
2008-05-30- Avoid warning about missing brace. No obj-code changes.Bernhard Reutner-Fischer
2007-12-03Blackfin FD-PIC patches 5/6.Bernd Schmidt
A couple more target macros for ld.so to deal with FD-PIC support. We need special code to compute the initial got and dpnt, and we need to pass extra arguments to _dl_get_ready_to_run.
2007-11-16Added AVR32 support to uClibc. Signed-off-by: Hans-Christian Egtvedt ↵Carmelo Amoroso
<hcegtvedt@atmel.com>
2006-11-17Bernd Schmidt writes:Mike Frysinger
This reintroduces a mechanism identical to the DL_BOOT macro present in older versions of uClibc. On Blackfin and FRV, we want to pass more than one argument to _dl_start. We also want to do something special before returning, so delete the warning when the START macro is defined.
2006-10-07Bernd Schmidt writes:Mike Frysinger
This introduces a new SEND_EARLY_STDERR macro that is to be used in dl-startup.c before ld.so is relocated. It is needed on Blackfin (and frv) FDPIC since we have to use special tricks to get the address of a string constant. EARLY_STDERR_SPECIAL gets defined on such a machine and prevents printing of debug strings inside the loop that relocates ld.so, since we can't decide which of the two variants to use.
2006-09-19merge some more FDPIC related fixes from Bernd SchmidtMike Frysinger
2006-07-05patch from Bernd Schmidt to abstract away initializing of relocation addressesMike Frysinger
2006-07-05patch from Bernd Schmidt to abstract away load address typesMike Frysinger
2006-07-05patch from Bernd Schmidt to abstract away load addressesMike Frysinger
2006-07-05revert fdpic patch so we can merge it in bit by bitMike Frysinger
2006-06-30Bernd Schmidt writes: abstract away addresses so we can support FDPIC ELFsMike Frysinger
2006-06-30Bernd Schmidt writes: too many semicolons!Mike Frysinger
2006-01-17since just about everyone uses return _dl_elf_main for START() now, make it ↵Mike Frysinger
the default
2005-12-16Remove all trailing ; after *_alias and change 2 to use weak_alias instead ↵Peter S. Mazinger
of __attribute__ ...
2005-08-09disable early debug code if the arch relies on certain values (like ↵Mike Frysinger
load_addr) which are computer later
2005-07-13dump the address we transfer control toMike Frysinger
2005-07-11minor touchups in debug output/commentsMike Frysinger
2005-07-11base __rtld_stack_end off of argv instead of args so we dont have to worry ↵Mike Frysinger
about how each arch treats args
2005-07-08add some more useful debug outputMike Frysinger
2005-07-08need _DEBUG macros for NUMBER tooMike Frysinger
2005-07-07get rid of arch-specific defines in dl-startup.c and make each arch declare ↵Mike Frysinger
its requirements about initial bootstrapping
2005-07-07add debug code for showing argc/argv/envp and touch up some other debug outputMike Frysinger
2005-07-04use the a_val member instead of a_ptr/a_fcn since newer elf defines dropped ↵Mike Frysinger
the other values
2005-06-30create generic ELF_* macros to hide 32/64 bit differencesMike Frysinger
2005-06-30change all Elf32_* usage to ElfW(*) usage since we shouldnt care about the ↵Mike Frysinger
bitsize