summaryrefslogtreecommitdiff
path: root/libexec/ld.so
AgeCommit message (Collapse)Author
2013-06-01Introduce ltrace(1). This tool works with ld.so to inject utrace record forMiod Vallat
each plt call, allowing to trace a binary linked against shared library at the public function call level. To do so, ltrace(1) sets up some environment variables to enable plt tracing in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy binding and will send an utrace record in the plt resolver, without updating the plt. Minimal filtering capabilities are provided, inspired by Solaris' truss -u, to limit tracing to libraries and/or symbol names. Non-traced libraries and symbols will have the regular resolver processing, with the expected plt update. "Get it in" deraadt
2013-05-17Try and support the non-PIC TEXTREL relocations which may creep in binariesMiod Vallat
when linked against non-pic material (such as linking against libgcc without passing -fpic or -fPIC on the commandline). Given the large userland address space (4GB) and random library placement, it is unlikely that these relocations can ever suceed anyway (DISP26 only allows for a 256MB offset); _dl_exit() in that case, after printing a warning message. That's better than dumping core.
2013-05-08Implement symbol caching and RELACOUNT/RELCOUNT optimizations.Philip Guenther
Much assistance and testing by miod ok miod@
2013-05-04fix use after free in error pathsJonathan Gray
ok sthen@ jung@ fgsch@
2013-04-20Prefer the processor-specific _DYNAMIC[] tags value to find out the boundariesMiod Vallat
of the .plt whenever possible, and fallback to the old behaviour of searching for special symbols pointing to its boundaries. No functional change.
2013-04-16an acceptable time_t truncation (binding cannot take that long)Theo de Raadt
ok matthew
2013-04-05- Add ORIGIN, OSNAME, OSREL and PLATFORM substitution support for rpaths.Kurt Miller
Improvements and okay matthew@, millert@, guenther@
2013-03-29Enable lazy binding by default.Miod Vallat
2013-03-26SH is a RelA architecture, not a Rel one. Fix _dl_bind() and lazy gotpltMiod Vallat
relocation to correctly process RelA entries. This allows lazy binding to work so far; not enabled yet, must survive some serious churning first.
2013-03-26Recommit the change that explicitly passes %sr0 to fic instructions. miod@ isMark Kettenis
still puzzled why this didn't work back in 2010, but it does work now and paves the way for binutils 2.17 on hppa. Obviously based on miod@'s earlier diff. ok miod@
2013-03-24dlerror() should not return const char *, as noted by landryTheo de Raadt
ok guenther
2013-03-20- Parse colon separated paths into NULL terminated arrays of stringKurt Miller
pointers to prepare for adding rpath ORIGIN support. okay matthew@ millert@
2013-03-18Fix comment tpyosPhilip Guenther
2013-02-17Always enter this ld.so and subdirectories to create obj (and then theTheo de Raadt
MI man pages, even if vax currently lacks the programs)
2013-02-06Add a dummy memcpy(), needed when building ld.so with gcc3.Miod Vallat
2013-02-02Be sure to pass a NULL cleanup pointer to CSU.Miod Vallat
2013-01-31The code to use relative jumps in the GOT was completely broken, calculatingPhilip Guenther
the offset in the wrong direction, failing to take into account where in the relocation the jump would be, and not even using the right instructions in one case. Fortunately(?), the test of whether the offset was small enough had signed-vs-unsigned bugs too, so it was never used. ok miod@
2013-01-26Make sure to flush I$ over the plt in case of non-lazy relocation as well.Miod Vallat
2013-01-26Forgot to remove one line in 1.2, in turn caused div() from libc to fail ifMiod Vallat
invoked with lazy binding.
2013-01-23bits for an m68k ELF ld.so, to be used soon. Lazy resolver wrapper borrowed fromMiod Vallat
NetBSD.
2013-01-23Cache flush .plt after updating its pointers to .got during the initialMiod Vallat
object relocation, if loaded at a different address than the one it was compiled for; unsurprisingly fixes some spurious crashes.
2013-01-21Use jmp, not jsr, to jump through registers. Doh!Miod Vallat
This makes lazy binding work, so don't disable it anymore.
2013-01-21Correctly define RELOC_JMP_SLOT on m88k. While there, remove the old sparcMiod Vallat
wrong RELOC_JMP_SLOT define workaround.
2013-01-20A first cut at ld.so bits for m88k. Lazy binding is currently disabled as itMiod Vallat
does not work beyond the first few lazy resolver calls. But that's already enough to run simple binaries.
2013-01-19Do not divide by zero in _dl_findhint() if there is a valid hints file butMiod Vallat
no buckets in it (could happen if the administrator reruns ldconfig with bogus paths). ok matthew@ kurt@ drahn
2013-01-14Do not bogusly attempt to mprotect ld.so's .rodata area RW at bootstrapMiod Vallat
time: the logic is wrong, and there are no relocations to apply to .rodata anyway. ok jsing@ kettenis@
2013-01-13Correctly process RELOC_DIR32 while relocating ld.so itself; this allowMiod Vallat
global data initializers to work as intended. ok drahn kettenis@
2013-01-11Proper bounds checking for DT_xxx values in _dl_boot_bind(). Turned out to beMiod Vallat
harmless because we have full control over the array being processed, and none of the values we set up may trigger the bug; yet this may change in the future. ok drahn matthew@
2013-01-05Switch m88k ports to ELF.Miod Vallat
2013-01-05if defined(NOPIC), do not attempt to .include arch/Makefile.inc for it mayMiod Vallat
not exist yet.
2012-12-31Spell `calculation' correctly.Miod Vallat
2012-12-22Zero %r0 before transferring control to the main program, to indicate thatMark Kettenis
the main program should not register a cleanup handler with atexit(3). This will allow us to add the cleanup handler registration code to crt0.c and have ld.so pass its cleanup handler to the main program in the future. tested by tobiasu@ ok kurt@
2012-12-05Remove excessive sys/cdefs.h inclusionTheo de Raadt
ok guenther millert kettenis
2012-11-01Zero v0 before transferring control to the main program to indicate thatMark Kettenis
the main program should not reguster a cleanup handler with atexit(3). This will allow us to add the cleanup handler registration code to crt0.c and have ld.so pass its cleanup handler to the main program in the future. While there, also zero ra to mark the last stack frame as demanded by the ELF ABI. ok kurt@, miod@
2012-11-01Clear r7 before passing control to the main object.Mark Kettenis
2012-10-27Clear arg1 before passing control to the main object.Mark Kettenis
2012-10-24Garbage-collect the _dl_stat() routine, now unusedPhilip Guenthe
ok matthew@ deraadt@
2012-10-22Zero %rdx before transferring control to the main program, to indicate thatMark Kettenis
the main program should not register a cleanup handler with atexit(3). This will allow us to add the cleanup handler registration code to crt0.c and have ld.so pass its cleanup handler to the main program in the future. ok kurt@
2012-10-22Stop passing around PS_STRINGS in %g1. The ELF ABI reserves this registerMark Kettenis
for passing around a pointer to a cleanup function and we'd like to use it for that purpose in the near future. ok miod@
2012-10-22Stop passing around PS_STRINGS in %g1. The ELF ABI reserves this registerMark Kettenis
for passing around a pointer to a cleanup function and we'd like to use it for that purpose in the near future. ok miod@
2012-09-17replace the erroneous DIAGNOSTICS section with a (hopefully) accurateJason McIntyre
EXIT STATUS one; ok guenther
2012-09-12Define empty CDIAGFLAGS for programs that use Werror.Christiano F. Haesbaert
Makes "make build" build with WARNINGS=Yes on amd64. ok espie
2012-09-11prevent detection of bogus librariesMarc Espie
problem initially noticed by deraadt@, exchanged various patches with kettenis@ decided to fix the bug now, even though ldconfig could probably use a larger rewrite. okay matthew@
2012-09-02Specify an include path for SYS.h via CPPFLAGS not AFLAGSJonathan Gray
so mkdep can find it. This was breaking builds after recent changes to mkdep to error out if the compiler does. ok deraadt@
2012-08-31Compile ld.so with debug info. This will not only help people hacking onMark Kettenis
ld.so itself, but also make it easier to debug code that uses dlopen(3). ok deraadt@, matthew@
2012-08-31Since _dl_debug_map is only initialized if we see a DT_DEBUG tag, make sureMark Kettenis
it isn't NULL before we dereference it. Fixes perl PIE on hppa. ok matthew@, deraadt@
2012-08-28Add __guard_local as a hidden symbol to ld.so, kernel, and everyMatthew Dempsky
executable and DSO (via crtbegin.c/crtbeginS.c). Not used yet, but needed before GCC can start emitting -fstack-protector code that uses them instead of __guard.
2012-08-22Change ld.so and libc to use .openbsd.randomdata on ELF platforms forMatthew Dempsky
initializing their __guard values. For the time being, we're leaving libc's constructor method as a backup to make sure __guard actually gets initialized and to emit syslog warnings when it's not. Not really an ABI change, so no shlib bump... "hold on to your butts" ok deraadt, kettenis
2012-08-20Add support for .openbsd.randomdata sections and PT_OPENBSD_RANDOMIZEMatthew Dempsky
segments to the kernel, ld (2.15), and ld.so. Tested on alpha, amd64, i386, macppc, and sparc64 (thanks naddy, mpi, and okan!). Idea discussed for some time; committing now for further testing. ok deraadt
2012-08-17Fix mips64 and powerpc's ld.so syscall implementations by addingMatthew Dempsky
"memory" to the list of clobbered registers for all syscalls that accept a pointer. This prevents GCC from optimizing away memory loads and stores that otherwise appear unused in a function. Issue noted and identified by miod; fix by me. ok miod, mpi