aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf
Commit message (Collapse)AuthorAgeFilesLines
* Use the new freebsd output format from Binutils 2.13.1.David E. O'Brien2002-10-121-2/+2
| | | | Notes: svn path=/head/; revision=104954
* <machine/atomic.h> requires <sys/types.h>.Ruslan Ermilov2002-10-092-2/+1
| | | | | | | Reviewed by: jake, mike Notes: svn path=/head/; revision=104724
* Return an error if a symbol is not found in reloc_jmpslots() instead ofThomas Moestl2002-09-141-0/+2
| | | | | | | crashing. Notes: svn path=/head/; revision=103315
* Fix a nasty memory corruption bug caused by having a bogus pointerMarcel Moolenaar2002-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 Notes: svn path=/head/; revision=102249
* Include stddef.h for NULL definition, rather than rolling our own here.Warner Losh2002-08-211-2/+1
| | | | | | | Reviewed by: jdp Notes: svn path=/head/; revision=102235
* Add support for the R_IA64_IPLTLSB relocation in non-PLT context.Marcel Moolenaar2002-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. Notes: svn path=/head/; revision=102155
* Don't acquire the writer lock in rtld_exit when clearing the sharedJohn Polstra2002-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. Notes: svn path=/head/; revision=101532
* Add END markers to asm functions so that debuggers can find their size.Jake Burkholder2002-07-171-1/+3
| | | | Notes: svn path=/head/; revision=100265
* Remove the nanosleep calls from the spin loops in the locking code.John Polstra2002-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 Notes: svn path=/head/; revision=99506
* The .Nm utilityPhilippe Charnier2002-07-061-2/+6
| | | | Notes: svn path=/head/; revision=99500
* Update the asm statements to use the "+" modifier instead ofJohn Polstra2002-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 Notes: svn path=/head/; revision=98786
* Add needed include of mman.h to fix sparc64 buildworld.Jake Burkholder2002-06-241-1/+3
| | | | Notes: svn path=/head/; revision=98724
* The last bits of the alloca -> mmap fix. IA64 and SPARC64 (current only).Matthew 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 Notes: svn path=/head/; revision=98629
* This is the same alloca() fix as was committed for i386. David O'BrienMatthew Dillon2002-06-181-5/+17
| | | | | | | | | | | tested the patch on -stable. Reviewed by: obrien Approved by: jdp MFC after: 3 days Notes: svn path=/head/; revision=98382
* Dillon's recent commits to the dynamic linker without running themJohn Polstra2002-06-101-1/+0
| | | | | | | | | by me first have given me a good excuse to drop my MAINTAINERship. MFC after: 1 week Notes: svn path=/head/; revision=98104
* Correct a bug in the last commit. The whole point of creating a 'done:'Matthew 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> Notes: svn path=/head/; revision=98103
* In tracking down an installation seg fault with then openoffice portMatthew Dillon2002-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 Notes: svn path=/head/; revision=98100
* Include machine/ia64_cpu.h because we use ia64_mf().Marcel Moolenaar2002-05-211-0/+1
| | | | | | | Submitted by: ru Notes: svn path=/head/; revision=97026
* Fix handling of weak references to undefined symbols on ia64:Marcel Moolenaar2002-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 Notes: svn path=/head/; revision=95544
* Now that local symbols aren't looked up with the symbol hash table,Marcel Moolenaar2002-04-271-10/+3
| | | | | | | binding works for local symbols. Remove the workaround... Notes: svn path=/head/; revision=95540
* Don't do symbol lookups for local symbols. The symbol index in theMarcel Moolenaar2002-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 Notes: svn path=/head/; revision=95539
* Fix a relocation bug in the ia64 ld.so. Weak function pointers in sharedPeter Wemm2002-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. Notes: svn path=/head/; revision=94021
* Minor changes to make this work on sparc64.Jake Burkholder2002-04-021-33/+46
| | | | | | | | Approved by: jdp Tested on: alpha, i386, sparc64 Notes: svn path=/head/; revision=93610
* rtld support for sparc64.Jake Burkholder2002-03-135-0/+1073
| | | | | | | | Largely obtained from: netbsd Submitted by: jake, tmm Notes: svn path=/head/; revision=92195
* When searching an object that was opened with RTLD_GLOBAL, search its DAG too.Dag-Erling Smørgrav2002-02-271-3/+6
| | | | | | | | | PR: bin/25059 Approved by: jdp MFC after: 3 weeks Notes: svn path=/head/; revision=91444
* ld-elf.so.1 assumed a few too many things about the ordering of sectionsPeter Wemm2002-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) Notes: svn path=/head/; revision=90826
* Add support such that if LD_TRACE_LOADED_OBJECTS_ALL is defined to aDavid E. O'Brien2002-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> Notes: svn path=/head/; revision=90755
* Allow ldd(1) be used on shared libraries in addition to executables.Maxim Sobolev2002-02-041-9/+35
| | | | Notes: svn path=/head/; revision=90172
* Mark a function as __printflike()Kris Kennaway2002-02-041-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=90162
* Change the library search order so that LD_LIBRARY_PATH overridesJohn Polstra2002-01-251-2/+2
| | | | | | | | | | all others. PR: bin/28191 MFC after: 2 weeks Notes: svn path=/head/; revision=89783
* Change brk's prototype from char *brk(const char *) to int brk(const void *)David Malone2002-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 Notes: svn path=/head/; revision=89732
* mdoc(7) police: tidy up.Ruslan Ermilov2002-01-101-17/+25
| | | | Notes: svn path=/head/; revision=89230
* Update rtld for the "new" ia64 ABI. In the old toolchain, thePeter Wemm2001-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 Notes: svn path=/head/; revision=85677
* Fix a dependency violation (branch after alloc)Peter Wemm2001-10-291-1/+1
| | | | Notes: svn path=/head/; revision=85676
* Add ia64 support. Various adjustments were made to existing targets toDoug Rabson2001-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. Notes: svn path=/head/; revision=85004
* The support for accelerating find_symdef() with a cache was broken. ThisDoug Rabson2001-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 Notes: svn path=/head/; revision=84746
* mdoc(7) police:Ruslan Ermilov2001-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. Notes: svn path=/head/; revision=81251
* Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. TheSheldon Hearn2001-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> Notes: svn path=/head/; revision=80381
* mdoc(7) police: removed HISTORY info from the .Os call.Ruslan Ermilov2001-07-101-1/+1
| | | | Notes: svn path=/head/; revision=79529
* mdoc(7) police: remove extraneous .Pp before and/or after .Sh.Dima Dorfman2001-07-091-2/+0
| | | | Notes: svn path=/head/; revision=79454
* mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2).Ruslan Ermilov2001-07-061-1/+1
| | | | Notes: svn path=/head/; revision=79366
* Use new backup feature of install(1).Ruslan Ermilov2001-05-281-14/+1
| | | | Notes: svn path=/head/; revision=77348
* Performance improvements for the ELF dynamic linker. TheseJohn Polstra2001-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 Notes: svn path=/head/; revision=76296
* * include/elf.h has been repo copied to include/elf-hints.h, and it noDavid E. O'Brien2001-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. Notes: svn path=/head/; revision=76224
* - Backout botched attempt to intoduce MANSECT feature.Ruslan Ermilov2001-03-261-1/+1
| | | | | | | - MAN[1-9] -> MAN. Notes: svn path=/head/; revision=74814
* Prepare for mdoc(7)NG.Ruslan Ermilov2001-01-161-1/+1
| | | | Notes: svn path=/head/; revision=71099
* Fix a bug in which a program called dlclose from a destructor andJohn Polstra2001-01-051-2/+43
| | | | | | | got an assert failure in the dynamic linker. Notes: svn path=/head/; revision=70677
* Prepare for mdoc(7)NG.Ruslan Ermilov2000-12-201-3/+5
| | | | Notes: svn path=/head/; revision=70227
* Add `_PATH_DEVZERO'.David E. O'Brien2000-12-091-2/+3
| | | | | | | Use _PATH_* where where possible. Notes: svn path=/head/; revision=69793
* Remove the superfluous call to _rtld_error() in symlook_default().John Polstra2000-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. Notes: svn path=/head/; revision=68458