summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
Commit message (Collapse)AuthorAgeFilesLines
* Return an error if a symbol is not found in reloc_jmpslots() instead oftmm2002-09-141-0/+2
| | | | crashing.
* Fix a nasty memory corruption bug caused by having a bogus pointermarcel2002-08-221-0/+8
| | | | | | | | | | | | for the DT_IA64_PLT_RESERVE dynamic table entry. When a shared object does not have any PLT relocations, the linker apparently doesn't find it necessary to actually reserve the space for the BOR (Bind On Reference) entries as pointed to by the DTE. As a result, relocatable data in the PLT was overwritten, causing some unexpected control flow with annoyingly predictable outcome: coredump. To reproduce: % echo 'int main() { return 0; }' > foo.c % cc -o foo foo.c -lxpg4
* Include stddef.h for NULL definition, rather than rolling our own here.imp2002-08-211-2/+1
| | | | Reviewed by: jdp
* Add support for the R_IA64_IPLTLSB relocation in non-PLT context.marcel2002-08-201-0/+30
| | | | | | This relocation creates a function descriptor at the specified address and is commonly used for C++ to create virtual function tables.
* Don't acquire the writer lock in rtld_exit when clearing the sharedjdp2002-08-081-2/+0
| | | | | | | | objects' reference counts. This function is called by the atexit mechanism at program shutdown. I don't think the locking is necessary here. It caused OpenOffice builds to hang more often than not. Credit to Martin Blapp and Matt Dillon for helping to diagnose this problem and for testing the fix.
* Add END markers to asm functions so that debuggers can find their size.jake2002-07-171-1/+3
|
* Remove the nanosleep calls from the spin loops in the locking code.jdp2002-07-065-42/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They provided little benefit (if any) and they caused some problems in OpenOffice, at least in post-KSE -current and perhaps in other environments too. The nanosleep calls prevented the profiling timer from advancing during the spinloops, thereby preventing the thread scheduler from ever pre-empting the spinning thread. Alexander Kabaev diagnosed this problem, Martin Blapp helped with testing, and Matt Dillon provided some helpful suggestions. This is a short-term fix for a larger problem. The use of spinlocking isn't guaranteed to work in all cases. For example, if the spinning thread has higher priority than all other threads, it may never be pre-empted, and the thread holding the lock may never progress far enough to release the lock. On the other hand, spinlocking is the only locking that can work with an arbitrary unknown threads package. I have some ideas for a much better fix in the longer term. It would eliminate all locking inside the dynamic linker by making it safe for symbol lookups and lazy binding to proceed in parallel with a call to dlopen or dlclose. This means that the only mutual exclusion needed would be to prevent multiple simultaneous calls to dlopen and/or dlclose. That mutual exclusion could be put into the native pthreads library. Applications using foreign threads packages would have to make their own arrangements to ensure that they did not have multiple threads in dlopen and/or dlclose -- a reasonable requirement in my opinion. MFC after: 3 days
* The .Nm utilitycharnier2002-07-061-2/+6
|
* Update the asm statements to use the "+" modifier instead ofjdp2002-06-244-16/+16
| | | | | | | | | | matching constraints where appropriate. This makes the dynamic linker buildable at -O0 again. Thanks to Bruce Evans for identifying the cause of the build problem. MFC after: 1 week
* Add needed include of mman.h to fix sparc64 buildworld.jake2002-06-241-1/+3
|
* The last bits of the alloca -> mmap fix. IA64 and SPARC64 (current only).dillon2002-06-222-21/+58
| | | | | | | | Untested (testing request went unanswered), but sparc64 is not expected to cause problems. IA64 is not expected to cause problems but the patch was slightly more complex so the possibility exists. Approved by: jdp
* This is the same alloca() fix as was committed for i386. David O'Briendillon2002-06-181-5/+17
| | | | | | | | tested the patch on -stable. Reviewed by: obrien Approved by: jdp MFC after: 3 days
* Dillon's recent commits to the dynamic linker without running themjdp2002-06-101-1/+0
| | | | | | by me first have given me a good excuse to drop my MAINTAINERship. MFC after: 1 week
* Correct a bug in the last commit. The whole point of creating a 'done:'dillon2002-06-102-6/+6
| | | | | | | goto target was so the cache could be freed. So free the cache after done: rather then before done: (!) Submitted by: Gavin Atkinson <gavin@ury.york.ac.uk>
* In tracking down an installation seg fault with then openoffice portdillon2002-06-102-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | Martin Blapp determined that the elf dynamic loader was at fault. In particular, the loader uses alloca() to allocate a symbol cache on the stack. Normally this would work just fine, but if the loader is called from a threaded program and the object being loaded is fairly large the alloca() can blow away the thread stack and effect other nearby thread stacks as well. My testing showed that the symbol cache can be as large as 250KBytes during the openoffice port build and install sequence. Martin was able to work around the problem by disabling the symbol cache (cache = NULL;). However, this solution is not adequate for commit because it can cause an enormous cpu burden for applications which do a lot of dynamic loading (e.g. like konqueror). The solution is to use anonymous mmap() to temporarily allocate space to hold the symbol cache. In testing I found that replacing the alloca() with mmap() has no observable degredation in performance. It should be noted that this bug does not necessarily cause an immediate crash but can instead result in long term corruption and instability in applications that load modules from threads. The bug is almost certainly responsible for some of the instabilities found in konqueror, for example, and possibly netscape too. Sleuthing work by: Martin Blapp <mb@imp.ch> X-MFC after: Before or after the 4.6 release depending on the release engineers
* Include machine/ia64_cpu.h because we use ia64_mf().marcel2002-05-211-0/+1
| | | | Submitted by: ru
* Fix handling of weak references to undefined symbols on ia64:marcel2002-04-272-29/+21
| | | | | | | | | | | | | | | | o Set st_shndx for sym_zero to SHN_UNDEF instead of SHN_ABS. This gives us something to reliably test against. o For weak references to undefined sysmbols (as indicated by having st_shndx equals SHN_UNDEF) in the context of OPDs, the address of the OPD is to be zero, not the address of the function it contains. o For weak references to undefined symbols in all other cases (only DIR64LSB at this time), the actual relocated value is to be zero, not the value prior to relocating. Roughly speaking, weak references to undefined symbols are no-ops. Tested on: i386, ia64
* Now that local symbols aren't looked up with the symbol hash table,marcel2002-04-271-10/+3
| | | | binding works for local symbols. Remove the workaround...
* Don't do symbol lookups for local symbols. The symbol index in themarcel2002-04-271-7/+14
| | | | | | | | relocation identifies the symbol to which we need to bind. This solves a problem seen on ia64 where the symbol hash table does not contain local symbols and thus resulted in unresolved symbols. Tested on: alpha, i386, ia64
* Fix a relocation bug in the ia64 ld.so. Weak function pointers in sharedpeter2002-04-071-3/+16
| | | | | | | | | | | objects were not being correctly set to zero. Instead, the function descriptor pointer was set to the load address of the .so object. This caused gcc generated binaries to segfault on exit when crtbegin.asm's _fini code tested the __cxa_finalize() function pointer for zero. This is a bit of a hack because of a problem nearby workaround for find_symdef and its quirks (failures) for local symbols. This still needs to be fixed.
* Minor changes to make this work on sparc64.jake2002-04-021-33/+46
| | | | | Approved by: jdp Tested on: alpha, i386, sparc64
* rtld support for sparc64.jake2002-03-135-0/+1073
| | | | | Largely obtained from: netbsd Submitted by: jake, tmm
* When searching an object that was opened with RTLD_GLOBAL, search its DAG too.des2002-02-271-3/+6
| | | | | | PR: bin/25059 Approved by: jdp MFC after: 3 weeks
* ld-elf.so.1 assumed a few too many things about the ordering of sectionspeter2002-02-185-72/+265
| | | | | | | | | | | | | | produced by ld(8) (ie: that _DYNAMIC immediately follows the _GOT). The new binutils import changed that, and the intial GOT relocation broke. Use a custom linker script to provide a real end-of-GOT symbol. Update ld.so to deal with the new (faster) PLT format that gcc-3.1 and binutils can produce. This is probably incomplete, but appears to be working again. Obtained from: NetBSD (And a fix to a silly mistake that I made by: gallatin)
* Add support such that if LD_TRACE_LOADED_OBJECTS_ALL is defined to aobrien2002-02-172-2/+11
| | | | | | | | non-empty string in the environment; we indicate which objects caused each object to be loaded. PR: 30908 Submitted-by: Mike Meyer <mwm@mired.org>
* Allow ldd(1) be used on shared libraries in addition to executables.sobomax2002-02-041-9/+35
|
* Mark a function as __printflike()kris2002-02-041-1/+1
| | | | MFC after: 1 week
* Change the library search order so that LD_LIBRARY_PATH overridesjdp2002-01-251-2/+2
| | | | | | | all others. PR: bin/28191 MFC after: 2 weeks
* Change brk's prototype from char *brk(const char *) to int brk(const void *)dwmalone2002-01-241-1/+0
| | | | | | | | | | | | | | | and sbrk's prototype from char *sbrk(int) to void *sbrk(intptr_t). This makes us more consistant with NetBSD and standards which include these functions. Bruce pointed out that ptrdiff_t would probably have been better than intptr_t, but this doesn't match other implimentations. Also remove local declarations of sbrk and unnecessary casting. PR: 32296 Tested by: Harti Brandt <brandt@fokus.gmd.de> MFC after: 1 month
* mdoc(7) police: tidy up.ru2002-01-101-17/+25
|
* Update rtld for the "new" ia64 ABI. In the old toolchain, thepeter2001-10-297-9/+34
| | | | | | | | | | | | | | | DT_INIT and DT_FINI tags pointed to fptr records. In 2.11.2, it points to the actuall address of the function. On IA64 you cannot just take an address of a function, store it in a function pointer variable and call it.. the function pointers point to a fptr data block that has the target gp and address in it. This is absolutely necessary for using the in-tree binutils toolchain, but (unfortunately) will not work with old shared libraries. Save your old ld-elf.so.1 if you want to use old ones still. Do not mix-and-match. This is a no-op change for i386 and alpha. Reviewed by: dfr
* Fix a dependency violation (branch after alloc)peter2001-10-291-1/+1
|
* Add ia64 support. Various adjustments were made to existing targets todfr2001-10-1514-33/+1069
| | | | | cope with a few interface changes required by the ia64. In particular, function pointers on ia64 need special treatment in rtld.
* The support for accelerating find_symdef() with a cache was broken. Thisdfr2001-10-101-8/+9
| | | | | | | | fixes the problem and improves startup times for large applications such as KDE2 considerably. Reviewed by: jdp MFC after: 1 week
* mdoc(7) police:ru2001-08-071-4/+2
| | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
* Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. Thesheldonh2001-07-262-2/+2
| | | | | | | definitions are more readable, and it's possible that they're more portable to pathalogical platforms. Submitted by: David Hill <david@phobia.ms>
* mdoc(7) police: removed HISTORY info from the .Os call.ru2001-07-101-1/+1
|
* mdoc(7) police: remove extraneous .Pp before and/or after .Sh.dd2001-07-091-2/+0
|
* mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2).ru2001-07-061-1/+1
|
* Use new backup feature of install(1).ru2001-05-281-14/+1
|
* Performance improvements for the ELF dynamic linker. Thesejdp2001-05-055-18/+60
| | | | | | | | | | | | | | | | | | | | particularly help programs which load many shared libraries with a lot of relocations. Large C++ programs such as are found in KDE are a prime example. While relocating a shared object, maintain a vector of symbols which have already been looked up, directly indexed by symbol number. Typically, symbols which are referenced by a relocation entry are referenced by many of them. This is the same optimization I made to the a.out dynamic linker in 1995 (rtld.c revision 1.30). Also, compare the first character of a sought-after symbol with its symbol table entry before calling strcmp(). On a PII/400 these changes reduce the start-up time of a typical KDE program from 833 msec (elapsed) to 370 msec. MFC after: 5 days
* * include/elf.h has been repo copied to include/elf-hints.h, and it noobrien2001-05-021-1/+2
| | | | | | | | longer includes machine/elf.h. * consumers of elf.h now use the minimalist elf header possible. This change is motivated by Binutils 2.11.0 and too much clashing over our base elf headers and the Binutils elf headers.
* - Backout botched attempt to intoduce MANSECT feature.ru2001-03-261-1/+1
| | | | - MAN[1-9] -> MAN.
* Prepare for mdoc(7)NG.ru2001-01-161-1/+1
|
* Fix a bug in which a program called dlclose from a destructor andjdp2001-01-051-2/+43
| | | | got an assert failure in the dynamic linker.
* Prepare for mdoc(7)NG.ru2000-12-201-3/+5
|
* Add `_PATH_DEVZERO'.obrien2000-12-091-2/+3
| | | | Use _PATH_* where where possible.
* Remove the superfluous call to _rtld_error() in symlook_default().jdp2000-11-071-2/+0
| | | | | | | The function's callers generate the error message when appropriate. This eliminates the message ``Undefined symbol "__register_frame_info"'' which was bogusly returned by dlerror() in some cases.
* Add support for dlsym(RTLD_DEFAULT, ...).jdp2000-09-192-69/+97
|
* Pass two pointer parameters to the r_debug_state() hookjwd2000-08-261-8/+18
| | | | | | | | | | | | | | | function, thus allowing a debugger or other trace tool to easily grab the addresses of the needed structures off the stack. This change is transparent to gdb, which locates the link_map list and transfers it to debugger memory for comparison purposes. A sample program will be committed showing how this can be used. Reviewed by: John Polstra <jdp@FreeBSD.org>
OpenPOWER on IntegriCloud