History log of /src/libexec/ld.elf_so/load.c |
Revision | | Date | Author | Comments |
1.49 |
| 21-Sep-2020 |
kamil | Upgrade the SVR4 RTLD r_debug protocol to version 1
Changes: - Add a new field r_ldbase in the r_debug struct. - Set r_version to 1.
This harmonizes the support with OpenBSD and Linux. FreeBSD uses version 0 (or no version). Solaris uses version 2 that is not implemented elsewhere and relies on SVR4 specific design and interfaces.
Update the code comments as r_debug and link_map is used by other software than GDB, namely: sanitizers, rump, LLDB.
|
1.48 |
| 10-Jan-2017 |
christos | need <sys/stat.h>
|
1.47 |
| 27-Nov-2013 |
christos | branches: 1.47.8; CID 1132773: Fix file descriptor leak
|
1.46 |
| 20-Nov-2013 |
skrll | If dlopen of the dynamic linker is requested, e.g. by rump in rumpuser_dl_bootstrap, then return &_rtld_objself as the handle and do not create a duplicate mapping.
The handle is mostly useless as _rtld_objself doesn't appear on _rtld_objlist.
This fixes a problem on earm platforms where ld.elf_so (currently) has an init_array section. Calling this caused binaries to segv.
|
1.45 |
| 09-May-2013 |
christos | Fix refcount of the object we found in our list by name.
|
1.44 |
| 06-May-2013 |
christos | Fixed handling of DT_SONAME:
- add function to add name aliases for shared libraries loaded XXX[1]: we don't add a name during load time, only when DT_SONAME is present. - search already loaded objects in load_by_name for an already loaded object that matches our name and return it. - add missing initialization and cleanup for obj->names XXX[2]: should we make them SIMPLEQ? - Add XXX in rtld.c about getting the name of an object.
NB: This makes the jdk work again without resorting to a hack of putting the build path of libjvm.so into the run path (which is a security problem). XXX: Pullup-6?
|
1.43 |
| 06-May-2013 |
skrll | Trailing whitespace
|
1.42 |
| 24-Dec-2010 |
skrll | branches: 1.42.6; 1.42.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.41 |
| 19-Dec-2010 |
skrll | Sprinkle some KNF.
|
1.40 |
| 16-Dec-2010 |
skrll | s/rdbg/dbg/ in a few places.
|
1.39 |
| 16-Dec-2010 |
skrll | Remove incorrect comment.
|
1.38 |
| 16-Oct-2010 |
skrll | Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
|
1.37 |
| 27-Feb-2010 |
roy | Implement negative cache checks for symbol lookups. Uses the Donelist idea from FreeBSD.
|
1.36 |
| 19-May-2009 |
christos | warns=4
|
1.35 |
| 07-Dec-2007 |
ad | branches: 1.35.12; rtld changes for PR bin/37347:
- Apply patch from J.T. Conklin to execute .init/.fini functions in order. - Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs should be recording a dependency on libc, but it's too late to do that.
Ok christos@.
|
1.34 |
| 05-Oct-2007 |
ad | - Don't use the names malloc/free/etc, since we can end up pulling in libc's malloc which is not what we want. - Remove ancient memory compaction hack. Realloc on free memory is now an error again (from joerg@).
Ok christos@.
|
1.33 |
| 20-Sep-2007 |
cube | Don't remove the last component of filename before calling _rtld_digest_dynamic: it is done in expand(), and doing it twice is once too much. This fixes $ORIGIN expansion for dependencies.
|
1.32 |
| 18-May-2007 |
christos | branches: 1.32.4; Support Solaris-like $ORIGIN etc. expansions in paths.
|
1.31 |
| 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.30 |
| 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.29 |
| 22-Oct-2004 |
skrll | Add __RCSIDs.
OK'd by mycroft.
|
1.28 |
| 05-Jul-2004 |
cube | Make ld.elf_so use the new sysctl API. That allows the user to give any sysctl variable name in /etc/ld.so.conf. It also makes the ld.elf_so binary slightly smaller (at least on i386), and has no impact on performance.
Fixes PR 26100.
|
1.27 |
| 25-Nov-2003 |
christos | Don't try to preload an empty string.
|
1.26 |
| 24-Jul-2003 |
skrll | ANSIfy and de-__P().
|
1.25 |
| 05-Dec-2002 |
junyoung | A bit speedup: in _rtld_load_object(), save the number of calls to strcmp() by performing path name length comparison first. In the test with Mozilla, the number was reduced to 1068 from 7182 (yes, we saved 6114 strcmp()!).
|
1.24 |
| 05-Oct-2002 |
mycroft | Minor cleanup.
|
1.23 |
| 04-Oct-2002 |
mycroft | Pull out some objlist functions in ldd.
|
1.22 |
| 04-Oct-2002 |
mycroft | Don't actually bother maintaining _rtld_list_main and _rtld_list_global in ldd.
|
1.21 |
| 04-Oct-2002 |
mycroft | Move the definition of _rtld_list_main so ldd builds again.
|
1.20 |
| 03-Oct-2002 |
mycroft | As seen on tech-userlevel...
There are several optimizations here:
1) Objects on _rtld_list_main do not participate in the DAG structures at all. This is okay because all symbols must be resolvable at link/load time, and _rtld_list_main is always searched first, so any references from those objects must necessarily be resolved to other objects on _rtld_list_main.
(Making this work completely required setting obj->main a bit earlier; hence the RTLD_MAIN hack.)
2) Objects on _rtld_list_main are not put on _rtld_list_global, preventing an extra search.
3) A bit is used to keep track of whether an object is on _rtld_list_global, so we don't have to do a silly linear search.
4) A small attempt is made to prevent objects being put on the DAG lists multiple times (using a silly linear search).
The sum of this appears to be a ~10% (.3s) reduction in Mozilla's startup time on my 800MHz box.
Also, make sure _rtld_objmain->path is always set, just to make the debug output nicer.
|
1.19 |
| 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.18 |
| 12-Sep-2002 |
mycroft | Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit.
|
1.17 |
| 18-Jul-2002 |
abs | If /etc/ld.so.conf contains an invalid sysctl name any dynamically executable that uses the library on that line has the rather cryptic "sysctl" printed when it starts executing.
Switch to (_PATH_LD_HINTS": unknown sysctl for %s", name);
Discovered after someone copied /etc from an i386 to a sparc64 box.
|
1.16 |
| 01-Jun-2002 |
lukem | SIMPLEQ rototill: - implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n), this mirrors the functionality of SLIST_REMOVE() (the other singly-linked list type) and FreeBSD's STAILQ_REMOVE() - remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD(). this mirrors the functionality of SLIST_REMOVE_HEAD() (the other singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD() - remove notes about SIMPLEQ not supporting arbitrary element removal - use SIMPLEQ_FOREACH() instead of home-grown for loops - use SIMPLEQ_EMPTY() appropriately - use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly - reorder manual page; be consistent about how the types are listed - other minor cleanups
|
1.15 |
| 02-Nov-2001 |
skrll | branches: 1.15.2; Allow both space and colon as a separator in LD_PRELOAD. Document this and the fact that space may be retired in the future.
Closes misc/11961
Reviewed by christos
|
1.14 |
| 27-May-2001 |
christos | s/warn/xwarnx/ cuts down size by 50% by not pulling in stdio.
|
1.13 |
| 10-Nov-2000 |
mycroft | Make ldd(1) build again.
|
1.12 |
| 10-Nov-2000 |
mycroft | When dlopen()ing with RTLD_GLOBAL, also make dependent libraries RTLD_GLOBAL.
|
1.11 |
| 27-Dec-1999 |
christos | branches: 1.11.4; don't stutter when printing error messages.
|
1.10 |
| 15-Dec-1999 |
christos | make a debugging formatting statement work portably
|
1.9 |
| 15-Dec-1999 |
christos | Do what the people want. Support full sysctl names.
|
1.8 |
| 13-Dec-1999 |
christos | indent properly a debugging statement and fix grammar.
|
1.7 |
| 13-Dec-1999 |
christos | For the benefit of ldd and debuggers, append more Needed_Entry elements if the library transformation attached more than one element.
|
1.6 |
| 13-Dec-1999 |
christos | Enable parsing and mapping of hardware dependent libraries in ld.so.conf To be documented in the man page.
|
1.5 |
| 07-Nov-1999 |
mycroft | Changes from msaitoh to fix local/global symbol confusion, and to fix weak symbol support -- updated by me for elf.h changes.
|
1.4 |
| 31-May-1999 |
kleink | branches: 1.4.4; Implement LD_PRELOAD support.
|
1.3 |
| 01-Mar-1999 |
christos | branches: 1.3.2; KNF
|
1.2 |
| 24-Feb-1999 |
christos | Cleanup global variable access so rtld can be self relocating. Also KNF reloc.c and move md sparc parts to arch/sparc/mdreloc.c Now we don't need to load at address 0 on the i386 and the mips should be trivial to fix.
|
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.3.2.1 |
| 23-Jun-1999 |
perry | pullup 1.3->1.4 (klienk): LD_PRELOAD support
|
1.4.4.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.11.4.1 |
| 09-Dec-2001 |
he | Pull up revisions 1.12-1.15 (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.15.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.32.4.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.32.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.35.12.1 |
| 17-Mar-2012 |
bouyer | Pull up following revision(s) via patch (requested by skrll in ticket #1724): rescue/list.ldd: revision 1.4 lib/libc/dlfcn/dlfcn_elf.c: revision 1.7 libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.57 distrib/sets/lists/comp/mi: revision 1.1512 share/man/man3/Makefile: revision 1.56 libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.58 usr.bin/ldd/ldd.c: revision 1.15 libexec/ld.elf_so/rtld.h: revision 1.84 share/man/man3/dl_iterate_phdr.3: revision 1.1 libexec/ld.elf_so/rtld.c: revision 1.129 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.44 libexec/ld.elf_so/rtld.h: revision 1.89 libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.36 libexec/ld.elf_so/map_object.c: revision 1.41 libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.37 libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.46 include/link_elf.h: revision 1.10 libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.29 libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.26 libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.34 libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.31 libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.35 libexec/ld.elf_so/Makefile: revision 1.94 libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.32 libexec/ld.elf_so/Makefile: revision 1.95 libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.31 libexec/ld.elf_so/Makefile: revision 1.96 libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.32 libexec/ld.elf_so/reloc.c: revision 1.98 libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.33 sys/sys/exec_elf.h: revision 1.106 libexec/ld.elf_so/rtld.c: revision 1.130 libexec/ld.elf_so/load.c: revision 1.37 libexec/ld.elf_so/rtld.c: revision 1.131 libexec/ld.elf_so/load.c: revision 1.38 libexec/ld.elf_so/rtld.h: revision 1.90 libexec/ld.elf_so/headers.c: revision 1.36 libexec/ld.elf_so/rtld.h: revision 1.95 libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.30 libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.25 libexec/ld.elf_so/symbol.c: revision 1.50 libexec/ld.elf_so/symbol.c: revision 1.51 libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.43 libexec/ld.elf_so/symbol.c: revision 1.52 libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.27 libexec/ld.elf_so/symbol.c: revision 1.54 PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols when we are doing immediate binding, leave them alone and they will be dealt with later during lazy binding. From skrll@ Implement negative cache checks for symbol lookups. Uses the Donelist idea from FreeBSD. Use alloca(3) instead of local xmalloc for creating our DoneLists. This allows threaded programs to use us a little better, PR lib/43005. Implement dl_iterate_phdr. Somewhat taken from FreeBSD. Manual page from OpenBSD.
|
1.42.12.2 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.42.12.1 |
| 23-Jun-2013 |
tls | resync from head
|
1.42.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.47.8.1 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|