summaryrefslogtreecommitdiff
path: root/libexec/ld.elf_so/search.c
AgeCommit message (Collapse)Author
2020-04-22Mark _rtld_invalid_paths static as ldd can end up with two copiesjoerg
2019-10-13use strlcpy to ensure termination.mrg
the buffer is statically sized so that it works without an allocator, so truncation is the desired effect here.
2019-01-12print the program name when we don't find a library.christos
XXX: really most _rtld_error() should do that, and most do.
2013-05-06Trailing whitespaceskrll
2010-12-24Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN markedskrll
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.
2010-08-07Stricter matching for _rtld_invalid_paths by ensuring separator.joerg
Use mem* functions instead of str* for strings of known size.
2006-03-21Coverity CID 2749: Fix another double free. Instead of removing that lastchristos
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.
2006-03-18Fix some double frees / missing frees / use after freed allmatt
relating to _rtld_load_object. Fix Coverity CID 2601, 2600.
2004-10-22Add __RCSIDs.skrll
OK'd by mycroft.
2003-08-12Resolve dlsym(3) and friends directly so that dlsym(RTLD_NEXT,...) works.skrll
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.
2003-07-24ANSIfy and de-__P().skrll
2002-11-14In _rtld_load_library(), ensure that the old _rtld_error state (a message fromnathanw
a previous error, or NULL) is preserved if the search eventually succeeds. Addresses the problem pointed out in PR pkg/19024.
2002-10-05Minor cleanup.mycroft
2002-10-01Store pathnames of shared objects not found in search paths in cachejunyoung
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.
2002-09-24Remove the SVR4_LIBDIR madness.mycroft
2002-09-24Very minor cleanup of the previous.mycroft
2002-09-23Several small changes that shave 7-8% off the simple-exec-loop test:mycroft
* 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.
2000-07-27Adjust a comment after the Great Renaming.kleink
1999-11-04Remove ELFNAME defines since they are defined in sys/exec_elf.herh
1999-10-25Update to match new SVR4-style definition names in <sys/exec_elf.h>.kleink
1999-10-22Undo last change. While these macros are defined in exec_elf.h, they arehannken
enclosed by `#ifdef _KERNEL'.
1999-10-21Remove ELFNAME macros which are already defines in exec_elf.herh
1999-08-01Rearrange the shared library search path precedences to LD_LIBRARY_PATH >kleink
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.)
1999-03-01KNFchristos
1997-02-17use 'normal' ELF library lookup rulescgd
1997-02-03that which thou openest, thou shalt close.cgd
1996-12-16First cut at an ELF shared loader. Originally from John Polstra's FreeBSD elfcgd
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.