Home | History | Annotate | Download | only in ld.elf_so
History log of /src/libexec/ld.elf_so/search.c
RevisionDateAuthorComments
 1.27  22-Apr-2020  joerg Mark _rtld_invalid_paths static as ldd can end up with two copies
 1.26  13-Oct-2019  mrg use strlcpy to ensure termination.

the buffer is statically sized so that it works without an
allocator, so truncation is the desired effect here.
 1.25  12-Jan-2019  christos print the program name when we don't find a library.
XXX: really most _rtld_error() should do that, and most do.
 1.24  06-May-2013  skrll branches: 1.24.26; 1.24.28;
Trailing whitespace
 1.23  24-Dec-2010  skrll branches: 1.23.6; 1.23.12;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.
 1.22  07-Aug-2010  joerg Stricter matching for _rtld_invalid_paths by ensuring separator.
Use mem* functions instead of str* for strings of known size.
 1.21  21-Mar-2006  christos Coverity CID 2749: Fix another double free. Instead of removing that last
free() call, change the allocation policy to leave the responsibility for
allocation/freeing the pathname to _rtld_map_object(), instead of having
the caller allocate it and _rtld_map_object() free it. This simplifies the
code a lot and it is more efficient.
 1.20  18-Mar-2006  matt Fix some double frees / missing frees / use after freed all
relating to _rtld_load_object. Fix Coverity CID 2601, 2600.
 1.19  22-Oct-2004  skrll Add __RCSIDs.

OK'd by mycroft.
 1.18  12-Aug-2003  skrll Resolve dlsym(3) and friends directly so that dlsym(RTLD_NEXT,...) works.

Previously dlsym resolved to the version in crt0.o or libc which would
mean that the caller's shared object couldn't be determined correctly
using __builtin_return_address(0).

Mainly from FreeBSD, but adapted by me. Benefits of this solutions are:

- backward comptibility maintained
- existing broken binaries are fixed with a new ld.elf_so
- __mainprog_obj can be removed from crt0.o
- we do the same thing as FreeBSD

Fixes PR 22067.

OKed by Jason and Christos.
 1.17  24-Jul-2003  skrll ANSIfy and de-__P().
 1.16  14-Nov-2002  nathanw In _rtld_load_library(), ensure that the old _rtld_error state (a message from
a previous error, or NULL) is preserved if the search eventually succeeds.

Addresses the problem pointed out in PR pkg/19024.
 1.15  05-Oct-2002  mycroft Minor cleanup.
 1.14  01-Oct-2002  junyoung Store pathnames of shared objects not found in search paths in cache
and utilize it. This greatly reduces the number of calls to open(2) and
malloc(3) for programs like mozilla that depend on many shared objects
while it doesn't affect performance of small programs.
 1.13  24-Sep-2002  mycroft Remove the SVR4_LIBDIR madness.
 1.12  24-Sep-2002  mycroft Very minor cleanup of the previous.
 1.11  23-Sep-2002  mycroft Several small changes that shave 7-8% off the simple-exec-loop test:

* Rename _rtld_find_library() to _rtld_load_library(). It now calls
_rtld_load_object() if necessary to actually load the object, rather
than having the caller do it. To do this, it also takes the `mode'
argument that gets passed to _rtld_load_object().

* On a related note, remove _rtld_check_library(), and instead call
_rtld_load_object() to instead try actually loading the object. We
save two extra namei's and a bunch of redundant work (almost
literally the same code) this way.

* In _rtld_map_object(), mmap(2) the first page read-only, rather than
read(2)ing it.

* In _rtld_symlook_obj(), compare the *second* character of the symbol
name before calling strcmp(). (This first character is too
frequently `_', and turns out to not be helpful, in libc.)

* Also in _rtld_symlook_obj(), remove the bogus STT_FUNC special case
-- this also allows removing the `in_plt' argument to
_rtld_symlook_list() and _rtld_symlook_obj().

Also:

* In _rtld_obj_from_addr(), rather than trying to look up `_end' in
the each object, instead use obj->mapsize as the upper bound.
 1.10  27-Jul-2000  kleink branches: 1.10.2;
Adjust a comment after the Great Renaming.
 1.9  04-Nov-1999  erh branches: 1.9.6;
Remove ELFNAME defines since they are defined in sys/exec_elf.h
 1.8  25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.7  22-Oct-1999  hannken Undo last change. While these macros are defined in exec_elf.h, they are
enclosed by `#ifdef _KERNEL'.
 1.6  21-Oct-1999  erh Remove ELFNAME macros which are already defines in exec_elf.h
 1.5  01-Aug-1999  kleink branches: 1.5.2;
Rearrange the shared library search path precedences to LD_LIBRARY_PATH >
runpath > built-in default; this is the behaviour of the SVR4 shared loader,
and gives users the opportunity to override the runpath. (Addresses a report
on current-users by John Kohl.)
 1.4  01-Mar-1999  christos KNF
 1.3  17-Feb-1997  cgd use 'normal' ELF library lookup rules
 1.2  03-Feb-1997  cgd that which thou openest, thou shalt close.
 1.1  16-Dec-1996  cgd First cut at an ELF shared loader. Originally from John Polstra's FreeBSD elf
kit, then hacked on by Matt Thomas <matt@3am-software.com>, then by me (to
make it work with new versions of the toolchain, etc.). This runs, but it's
in serious need of cleaning and/or a fair bit of reworking. See the README
file for more information, and a list of things to do.
 1.5.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.6.1  09-Dec-2001  he Pull up revision 1.10 (requested by skrll):
Add init/fini section support in crtbegin and crtend, and introduce
support for DWARF2 exception handling. Fixes PR#12865, PR#13488,
PR#13489, and PR#13491. Also fix ld.elf_so to deal appropriately.
 1.10.2.1  28-May-2004  tron Apply patch (request by skrll in ticket #1702):
Bring "ld.elf_so" (mostly) in sync with NetBSD-current:
- MI and MD (e.g. under NetBSD-alpha) performance improvements
- RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT support
- much better structured code
- closes PR bin/25464
 1.23.12.1  23-Jun-2013  tls resync from head
 1.23.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.28.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.24.28.1  10-Jun-2019  christos Sync with HEAD
 1.24.26.1  18-Jan-2019  pgoyette Synch with HEAD

RSS XML Feed