summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
Commit message (Collapse)AuthorAgeFilesLines
...
* Only punctuation is an allowed argument type for open-close macrossheldonh2000-06-301-1/+2
| | | | | | such as Po/Pc, as explained by phantom. Reported by: billf
* Back out the previous change to the queue(3) interface.jake2000-05-262-5/+5
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-232-5/+5
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Eliminate unaligned accesses that occurred when relocating thejdp2000-05-221-12/+27
| | | | | | DWARF2 exception tables emitted by the compiler for C++ sources. These tables are tightly packed, and they contain some relocated addresses which are not well-aligned.
* Cross-reference ldd(1) in rtld(1) and vice versa.sheldonh2000-03-281-0/+1
|
* Fixed missing DPADDs.bde2000-03-271-4/+5
| | | | | Fixed some style bugs (some usual ones for LDADD, and misformatting of $FreeBSD$).
* Add a manual page for the ELF dynamic linker. I initially createdjdp2000-01-292-99/+22
| | | | | | rtld.1 by means of a repository copy from "src/libexec/rtld-aout/rtld.1". Then I edited it to make it (more) accurate for the ELF dynamic linker.
* When a threads package registers locking methods with dllockinit(),jdp2000-01-295-50/+137
| | | | | | | | | | figure out which shared object(s) contain the the locking methods and fully bind those objects as if they had been loaded with LD_BIND_NOW=1. The goal is to keep the locking methods from requiring any lazy binding. Otherwise infinite recursion occurs in _rtld_bind. This fixes the infinite recursion problem in the linuxthreads port.
* Block almost all signals in the default locking method instead ofjdp2000-01-254-32/+40
| | | | | | | | just a few of them. This looks like it solves the recent ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/lockdflt.c:55 failures seen by some applications such as JDK.
* Allow files in LD_PRELOAD to be separated by white space, like Solarisjdp2000-01-221-3/+4
| | | | and Linux.
* Revamp the mechanism for enumerating and calling shared objects'jdp2000-01-096-139/+187
| | | | | | | | | | | | init and fini functions. Now the code is very careful to hold no locks when calling these functions. Thus the dynamic linker cannot be re-entered with a lock already held. Remove the tolerance for recursive locking that I added in revision 1.2 of dllockinit.c. Recursive locking shouldn't happen any more. Mozilla and JDK users: I'd appreciate confirmation that things still work right (or at least the same) with these changes.
* Work around an assert failure in the dynamic linker's default threadjdp1999-12-284-16/+32
| | | | | | | | | | | | | | | | locking functions. If an application loads a shared object with dlopen() and the shared object has an init function which requires lazy binding, then _rtld_bind is called when the thread is already inside the dynamic linker. This leads to a recursive acquisition of the lock, which I was not expecting -- hence the assert failure. This work-around makes the default locking functions handle recursive locking. It is NOT the correct fix -- that should be implemented at the generic locking level rather than in the default locking functions. I will implement the correct fix in a future commit. Since the dllockinit() interface will likely need to change, warn about that in both the man page and the header file.
* Add a new function dllockinit() for registering thread lockingjdp1999-12-2711-45/+509
| | | | | | | | | | | | | | | | | | | functions to be used by the dynamic linker. This can be called by threads packages at start-up time. I will add the call to libc_r soon. Also add a default locking method that is used up until dllockinit() is called. The default method works by blocking SIGVTALRM, SIGPROF, and SIGALRM in critical sections. It is based on the observation that most user-space threads packages implement thread preemption with one of these signals (usually SIGVTALRM). The dynamic linker has never been reentrant, but it became less reentrant in revision 1.34 of "src/libexec/rtld-elf/rtld.c". Starting with that revision, multiple threads each doing lazy binding could interfere with each other. The usual symptom was that a symbol was falsely reported as undefined at start-up time. It was rare but not unseen. This commit fixes it.
* In revision 1.21 I changed the search order for shared libraries,jdp1999-11-191-1/+1
| | | | | | | but I forgot to make the corresponding fix to the comment. Rectify that. Submitted by: Tony Finch <fanf@demon.net>
* .Nm += "rtld"phantom1999-09-281-1/+2
| | | | apropos(1) now knows about rtld(1) manpage.
* Make jdk-1.1.8 work again. It turns out that some code insidejdp1999-09-051-5/+9
| | | | | | | | | | | | | | | libjava peeks into the dynamic linker's private Obj_Entry structures. My recent changes introduced some new members near the front of the structures, causing libjava to get the wrong fields. This commit moves the new members toward the end of the structure so that the layout of the portion that is relevant to JDK remains the same as before. I will work with the JDK porting team to see if we can come up with a less fragile way for them to do what they need to do. I understand the current approach was necessary in order to work around some limitations of the dynamic linker. Maybe it's not necessary any more.
* Enable -Wformat checking for debug_printf().jdp1999-09-041-1/+3
|
* Change the warning about unrecognized entries in the dynamic tablejdp1999-09-041-2/+2
| | | | | | | to a debug message which is disabled in production builds of the dynamic linker. The condition warned about is normally harmless. PR: bin/12849
* When looking up symbols, search the objects loaded at program startjdp1999-09-041-8/+8
| | | | | | | up first -- before the dlopened DAGs containing the referencing object. This makes dynamically loaded perl modules work properly again.
* Get the actual pathname of the dynamic linker from the executable'sjdp1999-08-303-12/+31
| | | | | | | PT_INTERP program header entry, to ensure that gdb always finds the right dynamic linker. Use obj->relocbase to simplify a few calculations where appropriate.
* When checking to see if a shared object is already loaded, look forjdp1999-08-303-7/+38
| | | | a device/inode match if no pathname match is found.
* Revamp the symbol lookup algorithm to cope better with objectsjdp1999-08-304-82/+245
| | | | | | | | | | | | | | | | | | | | | | loaded separately by dlopen that have global symbols with identical names. Viewing each dlopened object as a DAG which is linked by its DT_NEEDED entries in the dynamic table, the search order is as follows: * If the referencing object was linked with -Bsymbolic, search it internally. * Search all dlopened DAGs containing the referencing object. * Search all objects loaded at program start up. * Search all objects which were dlopened() using the RTLD_GLOBAL flag (which is now supported too). The search terminates as soon as a strong definition is found. Lacking that, the first weak definition is used. These rules match those of Solaris, as best I could determine them from its vague manual pages and the results of experiments I performed. PR: misc/12438
* When honoring -Bsymbolic, still keep searching if only a weakjdp1999-08-301-4/+8
| | | | definition was found in the referencing object.
* Simplify the logic in find_symdef().jdp1999-08-301-45/+41
|
* $Id$ -> $FreeBSD$peter1999-08-2818-18/+18
|
* Add a NULL pointer check whose absence could cause segmentationjdp1999-08-201-6/+6
| | | | | | | violations in certain obscure cases involving failed dlopens. Many thanks to Archie Cobbs for providing me with a good test case. Eliminate a block that existed only to localize a declaration.
* Change many asserts into normal errors. They were all for conditionsjdp1999-07-183-39/+65
| | | | | | caused by invalid shared objects rather than by internal errors. Enable format string mismatch checking for _rtld_error().
* Change the symbol used to find the end of an object's address spacejdp1999-07-141-2/+2
| | | | | from "end" to "_end". The former does not exist in most shared libraries. This fixes problems in dladdr() and dlsym(RTLD_NEXT, ...).
* Add code to 'handle' R_ALPHA_NONE relocations by ignoring them.dfr1999-07-121-1/+4
|
* Add a MAINTAINER line naming myself. We control the vertical. Wejdp1999-07-091-1/+2
| | | | control the horizontal.
* Fix bug: if a dlopen() failed (e.g., because of undefined symbols),jdp1999-07-091-38/+44
| | | | | | | | | | the dynamic linker didn't clean up properly. A subsequent dlopen() of the same object would appear to succeed. Another excellent fix from Max Khon. PR: bin/12471 Submitted by: Max Khon <fjoe@iclub.nsu.ru>
* Shake hands with GDB a little bit earlier so that it is possible tojdp1999-07-031-3/+3
| | | | | | debug the init functions. Submitted by: dfr
* Fix a reference counting problem when using dlopen(NULL, ...).jdp1999-06-251-3/+4
| | | | PR: bin/12129
* Fix a serious performance bug for large programs on the Alpha,jdp1999-06-257-103/+231
| | | | | | | | | | | | | | | discovered by Hidetoshi Shimokawa. Large programs need multiple GOTs. The lazy binding stub in the PLT can be reached from any of these GOTs, but the dynamic linker only has enough information to fix up the first GOT entry. Thus calls through the other GOTs went through the time-consuming lazy binding process on every call. This fix rewrites the PLT entries themselves to bypass the lazy binding. Tested by Hidetoshi Shimokawa and Steve Price. Reviewed by: Doug Rabson <dfr@freebsd.org>
* Back out my change from 6 April PDT that added a new dlversion()jdp1999-04-221-16/+1
| | | | | | | function. It was an ill-considered feature. It didn't solve the problem I wanted it to solve. And it added Yet Another Version Number that would have to be maintained at every release point. I'm nuking it now before anybody grows too fond of it.
* After relocating the main program, but before calling any of thejdp1999-04-211-7/+33
| | | | | | _init() functions, initialize the global variables "__progname" and "environ". This makes it possible for the _init() functions to call things like getenv() and err().
* The ELF specification says that the RPATH in the executable orjdp1999-04-091-4/+4
| | | | | shared object takes precedence over LD_LIBRARY_PATH. Make the dynamic linker do it that way.
* Eliminate all machine-dependent code from the main source body andjdp1999-04-0914-88/+488
| | | | | | | | | | | | | | | the Makefile, and move it down into the architecture-specific subdirectories. Eliminate an asm() statement for the i386. Make the dynamic linker work if it is built as an executable instead of as a shared library. See i386/Makefile.inc to find out how to do it. Note, this change is not enabled and it might never be enabled. But it might be useful in the future. Building the dynamic linker as an executable should make it start up faster, because it won't have any relocations. But in practice I suspect the difference is negligible.
* Fix a couple of typos in comments.jdp1999-04-071-3/+3
|
* Add a new function dlversion() which returns the version number ofjdp1999-04-071-1/+16
| | | | | | the dynamic linker in the same form as __FreeBSD_version. This is mainly intended for checking the dynamic linker version during a make world.
* Resolve undefined weak references to a value of 0. This solves thejdp1999-04-051-1/+13
| | | | | | "__deregister_frame_info" problem that was seen when combining a program linked using the old gcc with shared libraries that were built using egcs.
* If somebody does an execv("foo", NULL) (which theoretically is an error),peter1999-04-041-2/+2
| | | | | | | avoid crashing inside rtld (since it's easy) since everything else handles it. Of course, if the target program checks argv[], it'll fall over. Reviewed by: jdp
* - Commit the correct dladdr() implementation.nate1999-03-241-7/+14
| | | | Reviewed by: jdp@FreeBSD.org <This is the version he reviewed!>
* - Added dladdr(3) support.nate1999-03-241-1/+47
| | | | Reviewed by: jdp@FreeBSD.org
* - Set the system immutable flag when installing ld.so to avoid peoplenate1999-02-151-2/+3
| | | | | | accidentally clobbering it. Submitted by: numberous people on -current
* Use the runpath of the main program for locating libraries loaded bydfr1998-11-271-2/+2
| | | | | | dlopen(). Reviewed by: jdp
* Fix a bug in dlclose that broke the apache13 port. The list ofjdp1998-10-131-1/+2
| | | | loaded objects wasn't being maintained properly.
* Make LD_PRELOAD work for ELF.jdp1998-09-221-1/+38
|
* Fix a bug that showed up when debugging dynamically linked programs.jdp1998-09-161-3/+13
| | | | | | | | | | | | | | | | | | | References from GDB to "printf" and various other functions would find the versions in the dynamic linker itself, rather than the versions in the program's libc. This fix moves the GDB link map entry for the dynamic linker to the end of the search list, where its symbols will be found only if they are not found anywhere else. It was suggested by Doug Rabson, though I implemented it a little differently. I personally would prefer to leave the dynamic linker's entry out of the GDB search list altogether. But Doug argues that it is handy there for such things as setting breakpoints on dlopen(). So it stays for now, at least. Note, if we ever integrate the dynamic linker with libc (which has several important benefits to recommend it), this whole problem goes away.
* Make the pathname pointed to by the Obj_Entry structure for thejdp1998-09-151-3/+11
| | | | | | dynamic linker itself dynamically allocated. All of them are supposed to be dynamically allocated, but we cheated before. It made gdb unhappy under some circumstances.
OpenPOWER on IntegriCloud