History log of /src/libexec/ld.elf_so/rtld.c |
Revision | | Date | Author | Comments |
1.221 |
| 02-May-2025 |
riastradh | ld.elf_so: Narrow scope of -Wno-stack-protector.
Don't need it outside immediate _rtld_donelist_init callers.
PR lib/59388: ld.elf_so: -Wno-stack-protector applies too broadly
|
1.220 |
| 18-Apr-2025 |
riastradh | ld.elf_so: Call _rtld_die if relro fails; don't return -1.
Returning -1 was a pasto from where the original _rtld_relro call came from, in _rtld_do_copy_relocations.
PR lib/57792: SIGSEGV in ld.elf_so / _rtld_call_ifunc
|
1.219 |
| 18-Apr-2025 |
riastradh | ld.elf_so(1): Defer RELRO a bit for eagerly-bound (-z now) programs.
GNU binutils links programs a little differently if they're eagerly bound with -Wl,-z,now. In particular, the part of the .got relocated for ifuncs is covered by the RELRO region in eagerly-bound programs (-z now), but not in lazily-bound programs (default).
Presumably this is done under the premise that eagerly-bound programs will resolve all ifuncs at startup _before_ mprotecting the main object's RELRO region. But ld.elf_so was mprotecting it first, in _rtld_do_copy_relocations, and then resolving ifuncs -- at which the memory locations where it tries to write the resolutions will be mapped read-only.
(In contrast, for lazily bound programs, ifuncs may also be resolved lazily, so the locations they relocate are _not_ covered by the RELRO region and we don't run into any trouble)
To avoid this trouble, for eagerly-bound programs, we defer the RELRO mprotect of the main object by a little bit -- we move it from _rtld_do_copy_relocations to just after _rtld_call_init_functions.
PR lib/57792: SIGSEGV in ld.elf_so / _rtld_call_ifunc
|
1.218 |
| 31-Jan-2025 |
christos | Prefer the kernel passed exec name as opposed to argv[0] for the main object name, if available. This is more useful because it is an absolute path and more consistent.
|
1.217 |
| 19-Jan-2024 |
christos | branches: 1.217.2; use header decl of __fork()
|
1.216 |
| 03-Oct-2023 |
martin | PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so local copy of the atomic access support functions for machines that do not implement all required ops in hardware (like 32bit sparc).
XXX would be better to figure out a way to share this copy with libc (thereby using half as many RAS sections). But even if we would share it, we have to init it early enough for ld.elf_so internal uses.
|
1.215 |
| 30-Jul-2023 |
riastradh | ld.elf_so: Split hash functions into a separate file.
This way we can test them in isolation.
No functional change intended.
|
1.214 |
| 04-Jun-2023 |
riastradh | ld.elf_so: Sprinkle more debug messages on dlopen and error.
PR pkg/57445
|
1.213 |
| 23-Apr-2023 |
riastradh | dlopen(3): Read _rtld_objtail under the lock.
XXX pullup-8 XXX pullup-9 XXX pullup-10
|
1.212 |
| 13-Sep-2022 |
riastradh | branches: 1.212.2; ld.elf_so(8): Make fork take a shared, not exclusive, lock.
We only need to ensure that there are no concurrent modifications to the rtld data structures in flight, since the threads that began those modifications will not exist in the child and will therefore be unable to complete them in the child.
A shared lock suffices to ensure there are no such concurrent modifications in flight; an exclusive lock is not necessary, and can cause deadlock if fork is executed from a signal handler, which is explicitly allowed by POSIX (and our own sigaction(2) man page) which marks fork as async-signal-safe.
PR lib/56979
|
1.211 |
| 09-Apr-2022 |
riastradh | rtld: Convert membar_exit/enter to membar_release/acquire.
These are basic CAS-based locking primitives needing release and acquire semantics, nothing fancy here -- except the membar_sync parts which are questionable but not relevant to the present audit.
|
1.210 |
| 04-Dec-2021 |
skrll | Restore the fptr_t type of {init,fini}{,_array} that was removed when initial support for indirect functions was added. This fixes {init,fini}_array support on hppa where each member of the array is (already) a plabel.
Discussed with joerg.
4 files changed, 29 insertions(+), 39 deletions(-) : ----------------------------------------------------------------------
|
1.209 |
| 16-Jun-2021 |
riastradh | ld.elf_so(1): Omit needless membar_enter.
The use of membar_enter is to separate atomic r/m/w on a lock from the body of the critical section so two different critical sections happen in order:
body of previous critical section;
exit critical section: membar_exit(); atomic_r/m/w(lock stuff);
enter critical section: atomic_r/m/w(lock stuff); membar_enter();
body of next critical section;
_rtld_shared_enter does this, but it _also_ issued an extraneous membar_enter before the atomic_r/m/w part, which doesn't impose any semantically important order but may cost some performance.
|
1.208 |
| 30-May-2021 |
joerg | Don't use the return address hack with clang.
|
1.207 |
| 22-Sep-2020 |
kamil | branches: 1.207.2; Correct r_ldbase valuse
It shall be the relocbase value, not linkmap.
|
1.206 |
| 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.205 |
| 19-Apr-2020 |
joerg | Rename __atomic_fork to __locked_fork and give it &errno as argument. rtld and libc use different storage, so the initial version would incorrectly report the failure reason for fork().
There is still a small race condition inside ld.elf_so as it doesn't use thread-safe errno internally, but that's a more contained internal issue.
|
1.204 |
| 16-Apr-2020 |
joerg | Introduce intermediate locking for fork, so that the dynamic linker is in a consistent state. This most importantly avoids races between dlopen and friends and fork, potentially resulting in dead locks in the child when it itself tries to acquire locks.
|
1.203 |
| 04-Mar-2020 |
thorpej | PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends on a linker common page size boundary. However, if the common page size used by the linker is less than the VM page size being used by the kernel, this can end up in the middle of a VM page and when the region is write- protected, this can cause objects in neighboring .data to get incorrectly write-protected, resulting in a crash.
Avoid this situation by calculating the end of the RELRO region not by rounding memsz up to the VM page size, but rather by adding vaddr + memsz and then truncating to the VM page size.
Fixes PR toolchain/55043.
XXX pullup-9
|
1.202 |
| 29-Feb-2020 |
kamil | Implement and integrate GNU Hashing function
Define Elf_Hash struct that contains ELF/SYSV and GNU hash checksum. Implement _rtld_gnu_hash() for DT_GNU_HASH. Adapt existing code to compute all Elf_Hash types, instead of only the ELF/SYSV one. Rename _rtld_elf_hash() to _rtld_sysv_hash() to match the GNU toolchain terminology.
_rtld_gnu_hash() uses Dan Bernstein's string hash function posted eons ago on comp.lang.c.
|
1.201 |
| 08-Dec-2019 |
uwe | _rtld_relro - fix debug printf format for a size_t argument
|
1.200 |
| 04-Oct-2019 |
christos | use __func__ (c99, c++11) instead of __FUNCTION__
|
1.199 |
| 03-Oct-2019 |
tnn | improve error message
|
1.198 |
| 15-Sep-2019 |
kamil | Return the ELF loader dl_phdr_info information for dl_iterate_phdr(3)
Sync the behavior of dl_iterate_phdr(3) with Linux/FreeBSD/OpenBSD.
|
1.197 |
| 14-Apr-2019 |
christos | branches: 1.197.2; undo previous unlock/relock; it is not needed now that we added the tls model declaration to all externs in jemalloc (suggested by joerg@)
|
1.196 |
| 13-Apr-2019 |
christos | Fix c++ exceptions on arm; jemalloc calls _rtld_tls_get_addr from inside dl_iterate_phdr, so we need to unlock and relock.
|
1.195 |
| 30-Dec-2018 |
christos | binutils 2.31.1 can put copy relocations in the relro segment. Delay protecting the relro segment for the main object until copy relocations are done.
|
1.194 |
| 27-Dec-2018 |
christos | explain why we skip objmain.
|
1.193 |
| 17-Oct-2018 |
joerg | Move compatibility for pre-2.0 ELF binaries into separate file. Early ELF binaries defined dlopen and friends in crt0.o by using function pointers in the object handle passed from rtld. This contract wastes space when many shared objects are allocated and ties dynamic linker and rest of the system tightly together. Fake the entry points in a static object and restrict them to the platforms that had working ELF support at the time. Keep the magic and version field used by modern crt0.o for all architectures. The checks will be removed from crt0.o in a follow-up step.
|
1.192 |
| 03-Apr-2018 |
joerg | branches: 1.192.2; Rework ifunc support to address a number of short comings: - Move to a shared _rtld_call_ifunc for rel and rela architectures - Architectures using rel format must patch IRELATIVE non-PLT relocations like RELATIVE in additition to the later ifunc handling - Consistently record the delta to the end of the relocation group for non-PLT IRELATIVE relocations
Hidden ifunc is now supported on all ifunc platforms, even when using -fno-plt. The combination of -fno-plt and relro is broken due to incorrect GNU ld output though.
|
1.191 |
| 09-Mar-2018 |
joerg | Like Sparc, PowerPC can use IRELATIVE relocations in non-PLT sections.
|
1.190 |
| 11-Feb-2018 |
jakllsch | branches: 1.190.2; Wrap PowerPC #pragma goop in #if __GNUC_PREREQ__(6,0). Our older GCC warns/errors on it.
|
1.189 |
| 07-Feb-2018 |
mrg | update for GCC 6:
ignore -Wframe-address warnings for the ppc hack.
|
1.188 |
| 06-Nov-2017 |
joerg | init/fini for the main program is handled by crt0.o, so ifunc handling is skipped right now as it iterates the same list. Don't repeat that mistake and explicitly take care of it in the dynamic linker.
|
1.187 |
| 12-Aug-2017 |
joerg | Add sparc/sparc64 support for irelative relocations.
|
1.186 |
| 10-Aug-2017 |
joerg | Add IRELATIVE support for ARM, X86 and PowerPC.
|
1.185 |
| 11-Jul-2017 |
joerg | Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This functions are used for destructors of thread_local objects.
If a pending destructor exists, prevent unloading of shared objects. Introduce __dl_cxa_refcount interface for this purpose. When the last reference is gone and the object has been dlclose'd before, the unloading is finalized.
Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists on providing __cxa_thread_atexit as direct wrapper without further patching.
|
1.184 |
| 08-Jun-2017 |
joerg | Call _rtld_debug_state before running the global initialisers, so give gdb a chance to set break points etc.
|
1.183 |
| 27-Feb-2017 |
chs | branches: 1.183.4; tag the powerpc hackish_return_address() as __noinline.
|
1.182 |
| 01-Dec-2016 |
christos | branches: 1.182.2; n dl_iterate_phdr return the path not the name.
|
1.181 |
| 01-Dec-2016 |
christos | Instead of using a function to resolve symbols that should be supplied by the dynamic linker itself, use a version script that exposes them. From joerg@
|
1.180 |
| 30-Nov-2016 |
christos | add missing newline in comment
|
1.179 |
| 30-Nov-2016 |
christos | Emulate the standard symbol search order in dlsym() i.e. resolve weak or not found symbols that are in the dynamic linker list of exported symbols from the dynamic linker itself.
|
1.178 |
| 24-May-2016 |
christos | branches: 1.178.2; Put the name of the dynamic linker in allocated memory, so that it becomes part of the core file link-map, so that gdb can find it.
|
1.177 |
| 06-Apr-2015 |
yamt | Fix membars around rtld internal mutex.
This fixes the most of lockups i observed with Open vSwitch on NetBSD/amd64. ("most of" because it still occasionally locks up because of other problems. see PR/49816)
|
1.176 |
| 04-Apr-2015 |
joerg | lib/49813: Release mutex on error.
|
1.175 |
| 05-Mar-2015 |
skrll | HPPA hack for a problem where gdb doesn't see _rtld_debug_state when it's a single bv,n %r0(%rp) instruction.
The nullify confuses something.
|
1.174 |
| 25-Aug-2014 |
joerg | Add basic support for indirect functions. It allows providing a public function symbol with an implementation choosen at run time. Refactor calls to functions by address in ld.elf_so to create temporary function descriptors on the stack, if the address is not leaked outside.
Limitations: - no support for initialising static storage with function pointers - no support for unnamed resolver functions
Inspired by FreeBSD's r228435 by kib@freebsd.org.
|
1.173 |
| 18-Mar-2014 |
joerg | branches: 1.173.4; Ignore LD_BIND_NOW for setuid binaries, but keep it in the environment otherwise.
|
1.172 |
| 31-Jan-2014 |
joerg | Catch up with _lwp_park change.
|
1.171 |
| 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.170 |
| 19-Oct-2013 |
christos | fix unused variable warnings
|
1.169 |
| 09-May-2013 |
skrll | Remove redundant assignment. Hasn't been needed since 1999.
|
1.168 |
| 09-May-2013 |
christos | remove stray debugging
|
1.167 |
| 09-May-2013 |
christos | convert to SIMPLEQ like the rest of the queues.
|
1.166 |
| 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.165 |
| 06-May-2013 |
skrll | Trailing whitespace
|
1.164 |
| 06-May-2013 |
skrll | Disalble a debug only where it causes problems.
|
1.163 |
| 03-May-2013 |
matt | Remove dbg for _ctype_
|
1.162 |
| 02-May-2013 |
matt | Print out &_DYNAMIC too.
|
1.161 |
| 16-Dec-2012 |
dsl | Fix the other lwp_park() to pass 0 for the 'unpark' lwp.
|
1.160 |
| 16-Dec-2012 |
dsl | You need to pass 0 (not -1) to lwp_park() if you don't also want to do an unpark. Clearly this code path was never tested! Needs pullup to netbsd-6
|
1.159 |
| 01-Oct-2012 |
riastradh | On failure in _rtld_dlcheck, call _rtld_error, not xwarnx.
Callers need not call _rtld_error themselves now.
Fixes PR lib/41760. Should add the test case from the PR too.
|
1.158 |
| 15-Aug-2012 |
matt | branches: 1.158.2; Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).
|
1.157 |
| 13-Mar-2012 |
joerg | Mark _rtld_debug_state as not to be inlined. Add an explicit instruction barrier to prevent removal of calls to it.
|
1.156 |
| 16-Feb-2012 |
joerg | Add _dlauxinfo helper function to provide access to the ELF auxilary vector. This can normally be found via __ps_strings, but libc is initialised too early when linked dynamically and doesn't have access to it yet, so provide an alternative mechanism via ld.elf_so. Bump libc minor.
|
1.155 |
| 25-Nov-2011 |
joerg | branches: 1.155.2; 1.155.4; 1.155.6; Unbreak RTLD_NEXT and co on platforms that don't inline or tail call do_dlsym.
|
1.154 |
| 17-Nov-2011 |
joerg | FreeBSD bug report 161344: TLS area for the main thread is set up to early, if e.g. pointers to functions are used as initializers.
|
1.153 |
| 23-Oct-2011 |
christos | branches: 1.153.2; Don't block SIGTRAP so that on architectures where the debugger needs to be able to receive sigtrap for breakpoints to work, it can. For example we are setting breakpoints inside dlopen(), after we've blocked the signal, so the process keep trapping and looping over the trap instruction without being able to send the signal. Another way would be to move the _rtld_debug_state() calls outside the critical section...
|
1.152 |
| 13-Aug-2011 |
christos | disable debugging that makes us core dump
|
1.151 |
| 25-Jun-2011 |
nonaka | PR/45015: ld.elf_so: support ELF symbol versioning Applied latest patch.
|
1.150 |
| 02-Apr-2011 |
joerg | Revert pthread_atfork related change not intended for commit yet.
|
1.149 |
| 02-Apr-2011 |
joerg | Unbreak HPPA
|
1.148 |
| 29-Mar-2011 |
joerg | Block signals when using the exclusive lock.
|
1.147 |
| 28-Mar-2011 |
joerg | Refine locking scheme around init/fini to not hold the exclusive lock. Use a simple generation count instead and restart looking for work if it changed (e.g. due to an dlopen call from an init function). Leave the possible dlclose() race for now.
|
1.146 |
| 27-Mar-2011 |
joerg | exit, not enter
|
1.145 |
| 27-Mar-2011 |
joerg | Handle _rtld_exit as full entry point since other threads may still be running at the time.
|
1.144 |
| 27-Mar-2011 |
joerg | Add some debug messages for explicit rtld entry points
|
1.143 |
| 27-Mar-2011 |
joerg | Locking around dlclose()
|
1.142 |
| 26-Mar-2011 |
joerg | Fix merge error that broke HPPA
|
1.141 |
| 25-Mar-2011 |
joerg | Add basic locking to ld.elf_so.
|
1.140 |
| 13-Mar-2011 |
joerg | Fill in TLS related fields in dl_iterate_phdr if TLS is supported
|
1.139 |
| 09-Mar-2011 |
joerg | Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports _rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to setup the thread private area of all new threads. ld.elf_so is responsible for setting up the private area for the initial thread. Similar functions are called from _libc_init for static binaries, using dl_iterate_phdr to access the ELF Program Header.
Add test cases to exercise the different TLS storage models. Test cases are compiled and installed on all platforms, but are skipped on platforms not marked for TLS support.
This material is based upon work partially supported by The NetBSD Foundation under a contract with Joerg Sonnenberger.
It is inspired by the TLS support in FreeBSD by Doug Rabson and the clean ups of the DragonFly port of the original FreeBSD modifications.
|
1.138 |
| 24-Feb-2011 |
pooka | make DEBUG compile without RTLD_DEBUG
|
1.137 |
| 24-Dec-2010 |
skrll | branches: 1.137.2; 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.136 |
| 19-Dec-2010 |
skrll | Sprinkle some KNF.
|
1.135 |
| 19-Dec-2010 |
skrll | Remove unnecessary #ifdef RTLD_DEBUG
|
1.134 |
| 16-Dec-2010 |
joerg | Don't use normal environment handling functions from libc, but iterate once over the array and clean out entries as needed.
|
1.133 |
| 16-Dec-2010 |
skrll | s/rdbg/dbg/ in a few places.
|
1.132 |
| 29-Oct-2010 |
christos | PR/44010: YAMAMOTO Takashi: sbrk: grow 0xb3ba2000 failed, error = 12" (due to setenv changes?) Provide a mini unsetenv that does not allocate/free memory and does not bother about locking.
|
1.131 |
| 16-Oct-2010 |
skrll | Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
|
1.130 |
| 18-Mar-2010 |
roy | Use alloca(3) instead of local xmalloc for creating our DoneLists. This allows threaded programs to use us a little better, PR lib/43005. We need to disable SSP when using alloca.
|
1.129 |
| 27-Feb-2010 |
roy | Implement negative cache checks for symbol lookups. Uses the Donelist idea from FreeBSD.
|
1.128 |
| 10-Jan-2010 |
skrll | Fixup comment.
|
1.127 |
| 02-Dec-2009 |
christos | If the environment is corrupt, die. From FreeBSD.
|
1.126 |
| 17-Nov-2009 |
skrll | Make _rtld_pagesz of type size_t.
Fixes round_down for alpha which made ldd(1) break.
|
1.125 |
| 24-Sep-2009 |
pooka | Add Solarisa-like dlinfo() interface to the ELF dynamic linker. Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap chain at the given object. Other Solaris queries are currently unimplemented.
|
1.124 |
| 19-May-2009 |
christos | warns=4
|
1.123 |
| 26-Oct-2008 |
mrg | branches: 1.123.2; 1.123.8; if LD32DIR is defined: - look in src/compat/lib/libc for libc_pic. - define RTLD_ARCH_SUBDIR to "i386" or "sparc" for amd64 and sparc64 builds, respectively if RTLD_ARCH_SUBDIR is defined, add this path before RTLD_DEFAULT_LIBRARY_PATH in the default search path.
|
1.122 |
| 04-Oct-2008 |
skrll | lib/39649: dlsym(3) does not follow dependencies
Pull across code from FreeBSD to do a search of the passed object and it's NEEDED objects (dependencies).
Reviewed by gimpy.
|
1.121 |
| 27-Sep-2008 |
macallan | avoid usind __builtin_return_address(0) on PowerPC because it fails in Xorg's module loader. Should fix PR37812
|
1.120 |
| 24-Jul-2008 |
matt | Refactor common code to _rtld_relocate_plt_object to i386 and arm so they act like the other versions. In _rtld_bind, if the result is 0, call _rtld_die. Initialize _rtld_sym_zero.st_value to -_rtld_objself.maprelocbase. Now when the symbol is resolved, st_value + maprelocbase will equal 0 and the above check in _rtld_bind will fire and a call to NULL will be avoided.
|
1.119 |
| 23-Jul-2008 |
christos | abort() if we are trying to use an undefined weak symbol from the plt. Remove check from relocate_plt_object() since we cannot return _rtld_sym_zero anymore. Code from gimpy.
|
1.118 |
| 03-Jun-2008 |
ad | Don't bother unmapping the ELF header unless it overlaps the first load section.
|
1.117 |
| 07-Dec-2007 |
ad | branches: 1.117.6; 1.117.8; 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.116 |
| 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.115 |
| 21-Sep-2007 |
christos | Don't trust AT_SUN_EXECNAME, if we are set{u,g}id.
|
1.114 |
| 20-Sep-2007 |
christos | Use AT_SUN_EXECPATH instead of argv[0] for the executable name. This needs kernel support, which is not there yet, thus $ORIGIN is broken at this time. This is ok, nothing uses it yet.
|
1.113 |
| 18-May-2007 |
christos | branches: 1.113.4; Support Solaris-like $ORIGIN etc. expansions in paths.
|
1.112 |
| 08-Apr-2007 |
scw | Remove a test for defined(__SH5__).
|
1.111 |
| 22-Nov-2006 |
christos | branches: 1.111.2; 1.111.4; From defend dot the dot world at gmail dot com: Sanitize environment variables for set{u,g}id binaries, so that in case they are playing with set{u,g}id and exec'ing other binaries they don't get affected by the LD_{PRELOAD,DEBUG,LIBRARY_PATH} environment setup. We leave LD_BIND_NOW alone. There are no binaries affected in the base system.
|
1.110 |
| 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.109 |
| 12-Jan-2006 |
skrll | Bring across a change from FreeBSD from back in 1998:
"Fix a bug that showed up when debugging dynamically linked programs. 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."
"printf" isn't true for us, but various libc symbols are, e.g. "malloc".
Fixes PR 32074 as noted by uwe@
OK'd by christos@
|
1.108 |
| 11-Jan-2006 |
uwe | _GLOBAL_OFFSET_TABLE_ is only used if RTLD_DEBUG, so wrap its declaration too.
32-bit SuperH can not pretend that _GLOBAL_OFFSET_TABLE_ is a normal variable, because of the way PIC variable references is generated, but as compiler arranges for _GLOBAL_OFFSET_TABLE_ address to be in r12 anyway, just use that value by declaring it as a global register variable. Makes sh3 compile with RTLD_DEBUG.
|
1.107 |
| 22-Oct-2004 |
skrll | branches: 1.107.2; Add __RCSIDs.
OK'd by mycroft.
|
1.106 |
| 18-Jul-2004 |
thorpej | - Change the strong dlfcn names in libc to ___name, and make the __name versions used by others in libc weak, so that we have: name: weak __name: weak ___name: strong - Add __name strong aliases of the dlfcn names in ld.elf_so, so that we have: name: strong __name: strong
This allows ld.elf_so to self-resolve both the name and __name variants of the dlfcn functions, the former being required for dlfcn support in applications, the latter being required for dlfcn support in libc.
Fixes the problem described in:
http://mail-index.netbsd.org/tech-toolchain/2004/07/17/0000.html
Reviewed by Nick.
|
1.105 |
| 17-May-2004 |
skrll | Fix the dynamic linker for hppa using ELF.
Lazy binding doesn't work 100% of the time so force immediate binding. One possible reason is that the PLT stub blows away r20 which the compiler might not take into account.
|
1.104 |
| 17-May-2004 |
skrll | Test before commit.
|
1.103 |
| 17-May-2004 |
skrll | Re-arrange/correct some asserts.
|
1.102 |
| 12-May-2004 |
skrll | Garbage collect the RTLD_RELOCATE_SELF error.
|
1.101 |
| 07-Sep-2003 |
mycroft | branches: 1.101.2; Back out revision 1.100. There is something screwier going on.
|
1.100 |
| 31-Aug-2003 |
mycroft | dlsym() should not leave an error set. It confuses programs that check dlerror() (such as pkgsrc/graphics/transcode).
|
1.99 |
| 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.98 |
| 24-Jul-2003 |
skrll | ANSIfy and de-__P().
|
1.97 |
| 21-Jul-2003 |
skrll | arm and sh5 also have bogus DT_TEXTRELs. sh5 was already covered so just update the comment.
|
1.96 |
| 17-Jul-2003 |
skrll | Correct the in_plt parameter of a couple of _rtld_find_symdef calls.
The mips_reloc.c case is a no-op as _rtld_symlook_obj ignores in_plt for MIPS.
OK'ed by Charles.
|
1.95 |
| 30-Jun-2003 |
marcus | SH also has a bogus DT_TEXTREL, it seems.
|
1.94 |
| 05-Jun-2003 |
simonb | KNF- blank lines before code at start of functions.
|
1.93 |
| 30-May-2003 |
christos | Add RTLD_FIRST, RTLD_NEXT, RTLD_DEFAULT, from FreeBSD
|
1.92 |
| 24-Apr-2003 |
mycroft | Back out previous change for now -- it needs more work.
|
1.91 |
| 23-Apr-2003 |
mycroft | Attempt to give dlsym() the same symbol-searching semantics as _rtld_bind(). Tested in a handful of cases. Reviewed by: a dead silence
|
1.90 |
| 14-Dec-2002 |
junyoung | Gracefully exit when invoked directly. Use of assert() here caused a segfault. Address PR#11785.
|
1.89 |
| 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.88 |
| 24-Nov-2002 |
fvdl | For the debug case, print relocbase as well at the start of _rtld().
|
1.87 |
| 05-Oct-2002 |
mycroft | Minor cleanup.
|
1.86 |
| 04-Oct-2002 |
mycroft | Rearrange _rtld_map_object() a little, so that we don't have to have the first page of the object double-mapped. Not that it matters much, but someone was whinging about it. While I'm at it, nuke obj->phdr and obj->phsize; they're unused.
|
1.85 |
| 04-Oct-2002 |
mycroft | Move the definition of _rtld_list_main so ldd builds again.
|
1.84 |
| 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.83 |
| 03-Oct-2002 |
mycroft | Do not put objects on _rtld_list_main on any DAG member list -- any symbol we will have already been found during the _rtld_list_main walk, so there's no point in doing it again.
|
1.82 |
| 26-Sep-2002 |
mycroft | Implement a self-relocate function for the VAX.
|
1.81 |
| 26-Sep-2002 |
mycroft | Remove the `self' args to _rtld_relocate_objects() and _rtld_relocate_nonplt_objects().
|
1.80 |
| 26-Sep-2002 |
mycroft | Clean up _rtld_init() -- there is no need to avoid globals. Remove the call to _rtld_relocate_objects() completely -- except on VAX, where we TEMPORARILY call _rtld_relocate_nonplt_objects() directly. Also add more assertions -- ld.elf_so should never have PLT relocations.
|
1.79 |
| 26-Sep-2002 |
mycroft | Hm, the const isn't going to work.
|
1.78 |
| 26-Sep-2002 |
mycroft | Do not attempt to free(_rtld_objself.path) -- it's a pointer into our data segment.
|
1.77 |
| 25-Sep-2002 |
mycroft | #if defined -> #ifdef
|
1.76 |
| 24-Sep-2002 |
mycroft | Put back the `in_plt' nonsense for now. It turns out there is some deep-seated wackiness WRT function pointer comparisons...
|
1.75 |
| 24-Sep-2002 |
mycroft | Touch up a little more -- some of the dbg()s never actually printed anything.
|
1.74 |
| 24-Sep-2002 |
mycroft | Previous change was done wrong.
|
1.73 |
| 24-Sep-2002 |
junyoung | Make sure that dbg() is disabled if LD_DEBUG is not defined. Now debugging is easier with RTLD_DEBUG_RELOC.
|
1.72 |
| 24-Sep-2002 |
mycroft | Change the comment about l_offs.
|
1.71 |
| 24-Sep-2002 |
junyoung | Remove '\n' at the end of dbg strings.
|
1.70 |
| 24-Sep-2002 |
junyoung | END_SYM is no longer used.
|
1.69 |
| 24-Sep-2002 |
mycroft | Use/require AT_PAGESZ on all platforms. (The kernel has exported it for ~3 years now.) Use _rtld_pagesz instead of getpagesize() to determine the page size in our local malloc(). Saves a system call.
Also, since we're now relocated early, we don't need to be careful to avoid globals, so most of the VARPSZ hacks are eliminated.
|
1.68 |
| 24-Sep-2002 |
mycroft | Um, a little bit of sanity here: l_addr is always supposed to be obj->relocbase -- or so says the GDB code that uses it. So, set it to this on all platforms. It already was on VAX explicitly, and on everything else except MIPS implicitly (because mapbase==relocbase for all existing shlibs). For some silly/stupid reason, a new field was created that the MIPS GDB currently uses. Another MD #ifdef bites it.
|
1.67 |
| 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.66 |
| 21-Sep-2002 |
junyoung | Print the name of dynamic linker actually loaded.
|
1.65 |
| 20-Sep-2002 |
junyoung | Cosmetic changes (long lines).
|
1.64 |
| 19-Sep-2002 |
christos | don't core dump setting progname if argv[0] == NULL. From xs@kittenz.org
|
1.63 |
| 13-Sep-2002 |
mycroft | The textrel special case is only needed for MIPS (due to a bug in BFD).
|
1.62 |
| 13-Sep-2002 |
mycroft | Kill the sparc64 argc conversion hack.
|
1.61 |
| 13-Sep-2002 |
mycroft | Nuke an unneeded hack for the Alpha.
|
1.60 |
| 12-Sep-2002 |
mycroft | Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit.
|
1.59 |
| 12-Sep-2002 |
mycroft | ld.elf_so has no textrels on arm, i386 or vax -- and shouldn't on any platform, but that's beside the point.
|
1.58 |
| 12-Sep-2002 |
mycroft | Add a `relocbase' argument to _rtld() and _rtld_init(), which is passed in from the glue code in _rtld_start(). This is used to set objself.relocbase, rather than assuming that it's the same as objself.mapbase (or 0 on MIPS). Now -- with a bug fix to the kernel -- ld.elf_so can be linked at any VMA.
|
1.57 |
| 11-Sep-2002 |
mycroft | This is a gratuitous null commit to force rtld.o to be rebuilt.
|
1.56 |
| 06-Sep-2002 |
mycroft | Pass down an additional flag to _rtld_relocate_nonplt_objects() which indicates whether we're relocating ld.elf_so itself. Use this in some places rather than hackish tests on `dodebug'. (The Alpha and HPPA `dodebug' tests were actually noops, because RTLD_RELOCATE_SELF is not set, and therefore dodebug is always true.)
|
1.55 |
| 06-Sep-2002 |
junyoung | Remove typedef which was never used. Meaningless comment as well.
|
1.54 |
| 05-Sep-2002 |
mycroft | Remove all of the `mark' code. This is responsible for the `undefined PLT symbol' errors, probably because the increment gets interrupted occasionally by a signal. In general, _rtld_bind() should not modify ANY internal state.
|
1.53 |
| 26-Aug-2002 |
christos | save 4 system calls by using AT_{R,E}{U,G}ID.
|
1.52 |
| 09-Aug-2002 |
soren | Remove extraneous \n's in {err,warn}{,x}.
|
1.51 |
| 10-Jul-2002 |
fredette | Add support for dynamic linking on HP PA-RISC.
|
1.50 |
| 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.49 |
| 26-May-2002 |
wiz | __STDC__ is always defined on NetBSD.
|
1.48 |
| 03-Feb-2002 |
thorpej | branches: 1.48.2; Add support for dynamic linking on the SuperH. From Marcus Comstedt, with some bug fixes (namely, don't forget to consider the addend when processing relocations) from me.
|
1.47 |
| 14-Dec-2001 |
thorpej | Garbage-collect the OLD_GOT stuff.
|
1.46 |
| 14-Dec-2001 |
thorpej | binutils-current ld emits DT_TEXTREL into _DYNAMIC on arm-elf. Handle this.
|
1.45 |
| 10-May-2001 |
christos | Unloading objects, can cause other objects whose reference count becomes 0 to be unloaded. Make sure that when we unload those objects we remove any references to them from the globals list... This fixes SIGSEGV with apache+mod_php+mysql.
XXX: This fix should be pulled up.
christos
|
1.44 |
| 03-Feb-2001 |
pk | Avoid the use of a `switch(){}' statement before _rtld_init() is called. `switch()' code may be translated using a jump table approach which causes it to reference the equivalent of a global variable, something that must be avoided before _rtld_init() has run.
|
1.43 |
| 10-Nov-2000 |
mycroft | Make ldd(1) build again.
|
1.42 |
| 10-Nov-2000 |
mycroft | When dlopen()ing with RTLD_GLOBAL, also make dependent libraries RTLD_GLOBAL.
|
1.41 |
| 28-Aug-2000 |
scottb | copy the real object filename to the rtld object path so that the Dl_info structure can be properly filled by dladdr().
|
1.40 |
| 26-Jul-2000 |
mycroft | The ELF ABI declares that argc must fill an `argument slot'. Make it so. For __sparc_v9__ only, do a hack to make executables work temporarily before and after the kernel is switched.
|
1.39 |
| 26-Jul-2000 |
mycroft | Catch up with type changes. Also: * Apply DT_PLTRELSZ to (one of) pltrel or pltrela *after* we've finished parsing the headers, so we know which one. * Fix sparc64 bogons. (It works now!)
|
1.38 |
| 19-Jul-2000 |
thorpej | Make it build on non-VARPSZ again.
|
1.37 |
| 18-Jul-2000 |
eeh | Fix some issues with SPARC V9 ELF binaries.
|
1.36 |
| 17-Jul-2000 |
matt | More VAX ELF changes.
|
1.35 |
| 14-Jul-2000 |
matt | Initialize ld.elf_so's textsize.
|
1.34 |
| 16-Jun-2000 |
christos | branches: 1.34.2; Also set __mainprog_obj so .ini sections can call dlopen()
|
1.33 |
| 03-Jun-2000 |
jdolecek | slighly move the assert() added in last commit, so that it's actually useful
|
1.32 |
| 02-Jun-2000 |
jdolecek | _rtld_unref_dag(): needed->obj might be null if the unreffed object has some unsatisfied references (most often when compiled without necessary -Wl,-R), so check for that instead of causing null-dereference; this way the code has a chance to cleanup after itself and report the error to caller
Thanks to Jason Thorpe for helping fix this!
|
1.31 |
| 15-Apr-2000 |
erh | branches: 1.31.2; Cause ld.elf_so to find the symbols for __progname and environ and set them. If we wait until crt0 gets around to doing it it's too late for any library init functions.
|
1.30 |
| 15-Apr-2000 |
christos | re-indent sanely _rtld_dlsym() [no functional change]
|
1.29 |
| 07-Feb-2000 |
kleink | Change _rtld_dlclose() to unload the object via _rtld_unload_object() rather than by itself. Besides being duplicated code the open-coded version also did not take care of cleaning up after the object's DAG(!). Fixes PR bin/8905.
|
1.28 |
| 13-Dec-1999 |
christos | Enable parsing and mapping of hardware dependent libraries in ld.so.conf To be documented in the man page.
|
1.27 |
| 10-Nov-1999 |
thorpej | Name consistencty nit: curmark -> _rtld_curmark
|
1.26 |
| 10-Nov-1999 |
thorpej | Some slight cosmetic cleanup.
|
1.25 |
| 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.24 |
| 25-Oct-1999 |
kleink | Update to match new SVR4-style definition names in <sys/exec_elf.h>.
|
1.23 |
| 19-Aug-1999 |
christos | branches: 1.23.2; enable /etc/ld.so.conf processing [reviewed by thorpej]
|
1.22 |
| 01-Aug-1999 |
kleink | 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.21 |
| 22-Jul-1999 |
thorpej | When dlopen()'ing a shared object without an absolute pathname, search for it in the rpath of the main program as well as the path specified in LD_LIBRARY_PATH.
|
1.20 |
| 15-Jun-1999 |
kleink | Don't include the ident .note assembly when linting.
|
1.19 |
| 31-May-1999 |
kleink | Implement LD_PRELOAD support.
|
1.18 |
| 18-Apr-1999 |
ws | Add code to use the kernel provided page size. Enable this on the powerpc only for now.
|
1.17 |
| 08-Mar-1999 |
kleink | branches: 1.17.2; Update an i386-ismed comment.
|
1.16 |
| 03-Mar-1999 |
christos | Make this compile without -DRTLD_LOADER and fix printf format problems on the alpha.
|
1.15 |
| 01-Mar-1999 |
christos | KNF
|
1.14 |
| 27-Feb-1999 |
pk | Just initialize the stack-based temporary `rtld self' object.
|
1.13 |
| 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.12 |
| 10-Jan-1999 |
christos | Add i386 bits
|
1.11 |
| 09-Jan-1999 |
castor | Restore missing variable declaration with -DRTLD_DEBUG
|
1.10 |
| 07-Oct-1998 |
ross | Rewrite AuxInfo handling to track AuxID changes in sys/exec_elf.h.
|
1.9 |
| 15-Jul-1998 |
tv | Some local changes accidentally made it into the last commit; back that part out (noticed by mycroft; thanks!)
|
1.8 |
| 14-Jul-1998 |
tv | Change ld.so default behavior to RTLD_LOCAL, and make RTLD_LOCAL into a new flag bit. Keep RTLD_GLOBAL as an actual flag bit so it won't be re-used, or may be used for something later. Mask the dlopen() mode bits in ld.elf_so so a comparison against RTLD_NOW works. (RTLD_{LOCAL,GLOBAL} needs to be implemented for ld.elf_so.)
|
1.7 |
| 16-Jun-1998 |
mhitch | Don't forget to update _rtld_objtail when _rtld_dlclose() removes the current tail entry.
|
1.6 |
| 25-Mar-1998 |
mhitch | Add support for mips.
|
1.5 |
| 08-Oct-1997 |
mrg | branches: 1.5.2; WARNS?=1
|
1.4 |
| 15-Apr-1997 |
cgd | make sure that ld.elf_so's path is in the data segment
|
1.3 |
| 21-Mar-1997 |
cgd | put in two identifying notes, which new binutils snapshots will turn into PT_NOTE sections so they can be examined by execve() to figure out whether this is a native binary, what emulation it's to be run under, etc.
|
1.2 |
| 18-Dec-1996 |
cgd | nclude dlfcn.h, and pull RLTD_LAZY in from there. Assume that RTLD_NOW is RLTD_LAZY + 1 (for now), if it's not defined. RTLD_NOW should be defined in dlfcn.h, since some code (e.g. X11) wants it and assumes that it has the value currently used by our RTLD_LAZY.
|
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.2 |
| 27-Sep-1998 |
cgd | pull up rev 1.7 from trunk (mhitch).
|
1.5.2.1 |
| 08-May-1998 |
mycroft | Sync with trunk, per request of mycroft.
|
1.17.2.1 |
| 23-Jun-1999 |
perry | pullup 1.18->1.19 (klienk): LD_PRELOAD support
|
1.23.2.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.31.2.1 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.34.2.3 |
| 09-Dec-2001 |
he | Pull up revisions 1.42-1.45 (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.34.2.2 |
| 29-Aug-2000 |
scottb | pullup version 1.41 (approved by thorpej): copy the real object filename to the rtld object path so that the Dl_info structure can be properly filled by dladdr().
|
1.34.2.1 |
| 26-Jul-2000 |
mycroft | Approved by thorpej: Add support for sparc64, including MD code and variable page size support. Modify some variable types to insure they are the correct width on sparc64.
basesrc/libexec/ld.elf_so/arch/sparc64/Makefile.inc 0 -> 1.1 basesrc/libexec/ld.elf_so/arch/sparc64/mdreloc.c 0 -> 1.3 basesrc/libexec/ld.elf_so/arch/sparc64/rtld_start.S 0 -> 1.2 basesrc/libexec/ld.elf_so/headers.c 1.6 -> 1.8 basesrc/libexec/ld.elf_so/reloc.c 1.26 -> 1.27 basesrc/libexec/ld.elf_so/reloc.c 1.29 -> 1.31 basesrc/libexec/ld.elf_so/rtld.c 1.34 -> 1.35 basesrc/libexec/ld.elf_so/rtld.c 1.36 -> 1.40 basesrc/libexec/ld.elf_so/rtld.h 1.26 -> 1.27 basesrc/libexec/ld.elf_so/symbol.c 1.7 -> 1.9
|
1.48.2.2 |
| 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.48.2.1 |
| 05-Sep-2003 |
tron | Pull up revision 1.54 via patch (requested by dmcmahill in ticket #1395): Remove all of the `mark' code. This is responsible for the `undefined PLT symbol' errors, probably because the increment gets interrupted occasionally by a signal. In general, _rtld_bind() should not modify ANY internal state.
|
1.101.2.1 |
| 19-Jul-2004 |
tron | Pull up revision 1.106 (requested by thorpej in ticket #676): - Change the strong dlfcn names in libc to ___name, and make the __name versions used by others in libc weak, so that we have: name: weak __name: weak ___name: strong - Add __name strong aliases of the dlfcn names in ld.elf_so, so that we have: name: strong __name: strong This allows ld.elf_so to self-resolve both the name and __name variants of the dlfcn functions, the former being required for dlfcn support in applications, the latter being required for dlfcn support in libc. Fixes the problem described in: http://mail-index.netbsd.org/tech-toolchain/2004/07/17/0000.html Reviewed by Nick.
|
1.107.2.2 |
| 08-Oct-2008 |
bouyer | Pull up following revision(s) (requested by jmcneill in ticket #1973): libexec/ld.elf_so/symbol.c: revision 1.47 libexec/ld.elf_so/rtld.h: revision 1.79 libexec/ld.elf_so/rtld.c: revision 1.122 lib/39649: dlsym(3) does not follow dependencies Pull across code from FreeBSD to do a search of the passed object and it's NEEDED objects (dependencies). Reviewed by gimpy.
|
1.107.2.1 |
| 01-Feb-2006 |
tron | Pull up following revision(s) (requested by christos in ticket #1150): libexec/ld.elf_so/rtld.c: revision 1.109 Bring across a change from FreeBSD from back in 1998: "Fix a bug that showed up when debugging dynamically linked programs. 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." "printf" isn't true for us, but various libc symbols are, e.g. "malloc". Fixes PR 32074 as noted by uwe@ OK'd by christos@
|
1.111.4.1 |
| 03-Sep-2007 |
wrstuden | Sync w/ NetBSD-4-RC_1
|
1.111.2.2 |
| 31-Oct-2008 |
snj | Pull up following revision(s) (requested by jmcneill in ticket #1211): libexec/ld.elf_so/symbol.c: revision 1.47 libexec/ld.elf_so/rtld.h: revision 1.79 libexec/ld.elf_so/rtld.c: revision 1.122 lib/39649: dlsym(3) does not follow dependencies Pull across code from FreeBSD to do a search of the passed object and its NEEDED objects (dependencies).
|
1.111.2.1 |
| 19-Jul-2007 |
liamjfoy | Pull up following revision(s) (requested by soren in ticket #774): build.sh: revision 1.169 gnu/usr.bin/gcc4/backend/Makefile: revision 1.9 sys/arch/evbsh5/README: revision 1.1 distrib/notes/common/contents: revision 1.124 usr.sbin/ndbootd/ndbootd.c: revision 1.12 gnu/lib/libopcodes/arch/sh3eb/defs.mk: revision 1.4 gnu/lib/libbfd/arch/sh3eb/defs.mk: revision 1.8 libexec/ld.elf_so/Makefile: revision 1.78 gnu/dist/binutils/bfd/config.bfd: revision 1.14 doc/HACKS: revision 1.93 distrib/cdrom/current.conf: revision 1.8 gnu/lib/libgcc4/Makefile.inc: revision 1.6 share/mk/sys.mk: revision 1.90 distrib/sets/lists/base/mi: revision 1.700 libexec/ld.elf_so/rtld.c: revision 1.112 distrib/sets/lists/base/mi: revision 1.702 sys/arch/sh5/README: revision 1.1 gnu/lib/libbfd/arch/sh3el/bfd.h: revision 1.7 usr.sbin/traceroute/traceroute.c: revision 1.69 distrib/notes/common/main: revision 1.330 distrib/notes/common/list-setsizes.sh: revision 1.2 sys/arch/Makefile: revision 1.35 gnu/lib/libopcodes/arch/sh3el/defs.mk: revision 1.4 gnu/lib/libbfd/arch/sh3el/defs.mk: revision 1.8 share/mk/bsd.own.mk: revision 1.495 gnu/lib/libbfd/arch/sh3eb/bfd.h: revision 1.7 x11/lib/OSmesa/Makefile: revision 1.20 sys/dev/dkwedge/dkwedge_bsdlabel.c: revision 1.13 gnu/dist/binutils/opcodes/configure.in: revision 1.2 gnu/dist/binutils/opcodes/configure: revision 1.2 gnu/usr.bin/send-pr/categories: revision 1.53 etc/mtree/NetBSD.dist: revision 1.339 sys/arch/README: revision 1.42 lib/libc/gdtoa/Makefile.inc: revision 1.6 usr.bin/crunch/crunchide/Makefile: revision 1.16 sys/lkm/net/bsdcomp/Makefile: revision 1.5 regress/sys/uvm/Makefile: revision 1.6 etc/MAKEDEV.awk: revision 1.18 x11/Xserver/GL/GLcore/Makefile.GLcore: revision 1.10 sys/contrib/dev/ath/netbsd/Makefile.ath.inc: revision 1.14 gnu/lib/libbfd/Makefile: revision 1.42 doc/RESPONSIBLE: revision 1.78 Remove evbsh5.
|
1.113.4.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.113.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.117.8.2 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.117.8.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.117.6.1 |
| 17-Jun-2008 |
yamt | sync with head.
|
1.123.8.2 |
| 19-Aug-2010 |
matt | Rework the debug printfs for env so that if the env array is corrupt at least some output happens.
|
1.123.8.1 |
| 21-Apr-2010 |
matt | sync to netbsd-5
|
1.123.2.3 |
| 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.123.2.2 |
| 03-Dec-2009 |
sborrill | Pull up the following revisions(s) (requested by tron in ticket #1179): libexec/ld.elf_so/rtld.c: revision 1.127
If the environment is corrupt, die. From FreeBSD.
|
1.123.2.1 |
| 14-Oct-2009 |
sborrill | Pull up the following revisions(s) (requested by pooka in ticket #1088): include/dlfcn.h: revision 1.20 lib/libc/dlfcn/dlfcn_elf.c: revision 1.6 libexec/ld.elf_so/reloc.c: revision 1.97 libexec/ld.elf_so/rtld.c: revision 1.125 libexec/ld.elf_so/rtld.h: revision 1.81 libexec/ld.elf_so/symbol.c: revision 1.48
Add Solarisa-like dlinfo() interface to the ELF dynamic linker. Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap chain at the given object. Other Solaris queries are currently unimplemented.
|
1.137.2.1 |
| 05-Mar-2011 |
bouyer | Sync with HEAD
|
1.153.2.4 |
| 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.153.2.3 |
| 23-Jan-2013 |
yamt | sync with head
|
1.153.2.2 |
| 30-Oct-2012 |
yamt | sync with head
|
1.153.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.155.6.1 |
| 17-Apr-2015 |
msaitoh | Pull up following revision(s) (requested by joerg in ticket #1288): libexec/ld.elf_so/rtld.c: revision 1.176 lib/49813: Release mutex on error.
|
1.155.4.1 |
| 22-Jan-2013 |
matt | Pullup from HEAD: Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).
|
1.155.2.4 |
| 16-Apr-2015 |
msaitoh | Pull up following revision(s) (requested by joerg in ticket #1288): libexec/ld.elf_so/rtld.c: revision 1.176 lib/49813: Release mutex on error.
|
1.155.2.3 |
| 25-Jan-2015 |
martin | Pull up the following, requested by he in ticket #1238: src/libexec/ld.elf_so/rtld.c 1.161 Fix the other lwp_park() to pass 0 for the 'unpark' lwp.
|
1.155.2.2 |
| 24-Jan-2015 |
martin | Pull up following revision(s) (requested by he in ticket #1238): libexec/ld.elf_so/rtld.c: revision 1.160 You need to pass 0 (not -1) to lwp_park() if you don't also want to do an unpark. Clearly this code path was never tested!
|
1.155.2.1 |
| 17-Oct-2012 |
riz | branches: 1.155.2.1.2; Pull up following revision(s) (requested by riastradh in ticket #605): libexec/ld.elf_so/rtld.c: revision 1.159 On failure in _rtld_dlcheck, call _rtld_error, not xwarnx. Callers need not call _rtld_error themselves now. Fixes PR lib/41760. Should add the test case from the PR too.
|
1.155.2.1.2.1 |
| 17-Apr-2015 |
msaitoh | Pull up following revision(s) (requested by joerg in ticket #1288): libexec/ld.elf_so/rtld.c: revision 1.176 lib/49813: Release mutex on error.
|
1.158.2.4 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.158.2.3 |
| 23-Jun-2013 |
tls | resync from head
|
1.158.2.2 |
| 25-Feb-2013 |
tls | resync with head
|
1.158.2.1 |
| 20-Nov-2012 |
tls | Resync to 2012-11-19 00:00:00 UTC
|
1.173.4.3 |
| 06-Mar-2016 |
martin | Catch up to -current, via patch, requested by christos in ticket #1126:
|
1.173.4.2 |
| 06-Apr-2015 |
snj | Pull up following revision(s) (requested by joerg in ticket #665): libexec/ld.elf_so/rtld.c: revision 1.176 lib/49813: Release mutex on error.
|
1.173.4.1 |
| 09-Mar-2015 |
snj | Pull up following revision(s) (requested by skrll in ticket #569): libexec/ld.elf_so/rtld.c: revision 1.175 HPPA hack for a problem where gdb doesn't see _rtld_debug_state when it's a single bv,n %r0(%rp) instruction. The nullify confuses something.
|
1.178.2.2 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.178.2.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.182.2.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.183.4.3 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1871):
libexec/ld.elf_so/rtld.c: revision 1.213
dlopen(3): Read _rtld_objtail under the lock.
|
1.183.4.2 |
| 29-Aug-2017 |
bouyer | Pull up following revision(s) (requested by joerg in ticket #127): tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.1 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h: revision 1.14 external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h: revision 1.17 lib/libc/stdlib/atexit.h: file removal lib/libc/stdlib/exit.c: revision 1.16 external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h: revision 1.8 lib/libc/stdlib/exit.c: revision 1.17 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h: revision 1.14 distrib/sets/lists/debug/shl.mi: revision 1.178 external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h: revision 1.21 distrib/sets/lists/debug/shl.mi: revision 1.179 distrib/sets/lists/debug/mi: revision 1.219 lib/libpthread/pthread.c: revision 1.150 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h: revision 1.14 libexec/ld.elf_so/symbols.map: revision 1.2 include/dlfcn.h: revision 1.25 external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h: revision 1.21 external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h: revision 1.23 external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h: revision 1.18 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h: revision 1.14 external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/ia64/c++config.h: revision 1.5 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h: revision 1.14 external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h: revision 1.17 distrib/sets/lists/tests/mi: revision 1.755 external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h: revision 1.20 external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h: revision 1.21 external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h: revision 1.21 external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h: revision 1.20 lib/libc/dlfcn/dlfcn_elf.c: revision 1.14 tests/libexec/ld.elf_so/t_thread_local_dtor.sh: revision 1.1 tests/lib/libpthread/t_thread_local_dtor.sh: revision 1.1 lib/libc/stdlib/Makefile.inc: revision 1.93 lib/libc/include/atexit.h: revision 1.1 lib/libc/include/atexit.h: revision 1.2 external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h: revision 1.14 distrib/sets/lists/debug/shl.mi: revision 1.180 external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h: revision 1.14 external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h: revision 1.14 lib/libc/stdlib/cxa_thread_atexit.c: revision 1.1 tests/libexec/ld.elf_so/helper_dso3/h_helper_dso3.cpp: revision 1.1 tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.1 external/gpl3/gcc/lib/libstdc++-v3/arch/riscv64/c++config.h: revision 1.5 libexec/ld.elf_so/rtld.c: revision 1.185 external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h: revision 1.19 external/gpl3/gcc/lib/libstdc++-v3/arch/riscv32/c++config.h: revision 1.5 external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h: revision 1.15 external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h: revision 1.21 external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h: revision 1.12 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h: revision 1.14 external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h: revision 1.15 external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h: revision 1.19 tests/libexec/ld.elf_so/Makefile: revision 1.9 external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h: revision 1.20 external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h: revision 1.14 tests/lib/libpthread/h_thread_local_dtor.cpp: revision 1.1 distrib/sets/lists/tests/shl.mi: revision 1.11 tests/lib/libpthread/Makefile: revision 1.13 libexec/ld.elf_so/rtld.h: revision 1.129 external/gpl3/gcc/lib/libstdc++-v3/arch/or1k/c++config.h: revision 1.6 Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This functions are used for destructors of thread_local objects. If a pending destructor exists, prevent unloading of shared objects. Introduce __dl_cxa_refcount interface for this purpose. When the last reference is gone and the object has been dlclose'd before, the unloading is finalized. Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists on providing __cxa_thread_atexit as direct wrapper without further patching. Fix filename of new debug file Add misising DEBUGLIB file Avoid common declaration. Drop TLS variant checks, emutls is enough for VAX and Sun2.
|
1.183.4.1 |
| 10-Jun-2017 |
snj | Pull up following revision(s) (requested by joerg in ticket #26): libexec/ld.elf_so/rtld.c: revision 1.184 Call _rtld_debug_state before running the global initialisers, so give gdb a chance to set break points etc.
|
1.190.2.4 |
| 18-Jan-2019 |
pgoyette | Synch with HEAD
|
1.190.2.3 |
| 20-Oct-2018 |
pgoyette | Sync with head
|
1.190.2.2 |
| 07-Apr-2018 |
pgoyette | Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
|
1.190.2.1 |
| 15-Mar-2018 |
pgoyette | Synch with HEAD
|
1.192.2.4 |
| 21-Apr-2020 |
martin | Sync with HEAD
|
1.192.2.3 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.192.2.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.192.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.197.2.8 |
| 06-Aug-2024 |
snj | Pull up following revision(s) (requested by martin in ticket #1861): libexec/ld.elf_so/rtld.c: 1.216 PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so local copy of the atomic access support functions for machines that do not implement all required ops in hardware (like 32bit sparc). XXX would be better to figure out a way to share this copy with libc (thereby using half as many RAS sections). But even if we would share it, we have to init it early enough for ld.elf_so internal uses.
|
1.197.2.7 |
| 04-Aug-2023 |
martin | Pull up following revision(s), all via patch, (requested by riastradh in ticket #1699):
distrib/sets/lists/tests/shl.mi: revision 1.14 distrib/sets/lists/tests/shl.mi: revision 1.15 distrib/sets/lists/tests/shl.mi: revision 1.16 tests/libexec/ld.elf_so/helper_def_static/h_def_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.2 libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.75 distrib/sets/lists/tests/mi: revision 1.1265 libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.36 libexec/ld.elf_so/rtld.c: revision 1.214 tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.1 distrib/sets/lists/debug/mi: revision 1.400 tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.2 distrib/sets/lists/debug/mi: revision 1.401 distrib/sets/lists/debug/mi: revision 1.402 tests/libexec/ld.elf_so/helper_dso2/Makefile: revision 1.2 distrib/sets/lists/debug/mi: revision 1.403 tests/libexec/ld.elf_so/helper_symver_dso0/Makefile: revision 1.2 libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.48 distrib/sets/lists/debug/mi: revision 1.406 tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_ifunc_dso/Makefile: revision 1.2 libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.70 libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.18 tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/Makefile: revision 1.13 libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.46 libexec/ld.elf_so/rtld.h: revision 1.146 tests/libexec/ld.elf_so/Makefile: revision 1.14 distrib/sets/lists/debug/shl.mi: revision 1.306 tests/libexec/ld.elf_so/Makefile: revision 1.15 tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.1 distrib/sets/lists/debug/shl.mi: revision 1.307 tests/libexec/ld.elf_so/Makefile: revision 1.16 tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.2 distrib/sets/lists/debug/shl.mi: revision 1.308 tests/libexec/ld.elf_so/Makefile: revision 1.17 distrib/sets/lists/debug/shl.mi: revision 1.309 tests/libexec/ld.elf_so/Makefile: revision 1.18 tests/libexec/ld.elf_so/Makefile: revision 1.19 libexec/ld.elf_so/tls.c: revision 1.16 libexec/ld.elf_so/tls.c: revision 1.17 libexec/ld.elf_so/tls.c: revision 1.18 libexec/ld.elf_so/tls.c: revision 1.19 tests/libexec/ld.elf_so/helper_onlydef_static/h_onlydef_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.2 tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.2 libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.50 distrib/sets/lists/debug/shl.mi: revision 1.310 libexec/ld.elf_so/README.TLS: revision 1.6 distrib/sets/lists/debug/shl.mi: revision 1.311 distrib/sets/lists/debug/shl.mi: revision 1.314 tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_symver_dso1/Makefile: revision 1.4 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.63 tests/libexec/ld.elf_so/helper_def_dynamic/h_def_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.2 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.10 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.11 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.12 libexec/ld.elf_so/map_object.c: revision 1.66 tests/libexec/ld.elf_so/helper.mk: revision 1.1 libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.57 libexec/ld.elf_so/map_object.c: revision 1.67 tests/libexec/ld.elf_so/helper_onlydef/h_onlydef.c: revision 1.1 tests/libexec/ld.elf_so/helper_symver_dso2/Makefile: revision 1.4 tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.3 tests/libexec/ld.elf_so/helper_use_dynamic/h_use_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_abuse_static/h_abuse_static.c: revision 1.1 libexec/ld.elf_so/arch/riscv/mdreloc.c: revision 1.9 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.1 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.2 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.3 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.4 tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.5 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.6 libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.34 tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.7 libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.42 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.8 libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.43 libexec/ld.elf_so/arch/or1k/mdreloc.c: revision 1.4 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.9 tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_abuse_dynamic/h_abuse_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlyctor_dynamic/h_onlyctor_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_static/h_onlyuse_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_dynamic/h_onlyuse_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_dso1/Makefile: revision 1.2 distrib/sets/lists/tests/shl.mi: revision 1.12 distrib/sets/lists/tests/shl.mi: revision 1.13 libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.44
ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.
ld.elf_so: Fix extern TLS test to match PR toolchain/50277. Now it's actually testing the problem. ld.elf_so: Nix inadvertently committed private test program. ld.elf_so: Fix set lists for MKDEBUG=yes builds with t_tls_extern.
ld.elf_so: Sprinkle tls debug messages.
ld.elf_so: Make tls alloc debug messages more detailed and greppable.
ld.elf_so: Test variations on PR toolchain/50277.
ld.elf_so: Test extern dynamic TLS too.
ld.elf_so: Factor out logic in TLS tests to make writing more easier. No functional change intended.
ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.
ld.elf_so: Shorter test names. No functional non-cosmetic change intended.
ld.elf_so: Separately test eager and lazy resolution of def tls ptr. eager: before loading use library lazy: after loading use library
Add recent ld.elf_so test helpers debug info ld.elf_so: Add new files to debug/shl.mi.
ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently. If a symbol has already been resolved as dynamic TLS, any library that tries to use it as static TLS cannot be dlopened.
ld.elf_so: Test another edge case of mismatched TLS models. One library defines a symbol and _doesn't_ use it, so it has no indication of whether the symbol is for static TLS or dynamic TLS, and then two other libraries use it in different ways.
ld.elf_so: Test dynamic-then-static abuse via ctor.
ld.elf_so: Fix missing tab in debug/shl.mi in last change.
Fix interactions of initial-exec TLS model and dlopen
(1) If an initial-exec relocation was used for a non-local symbol (i.e. the definition of the symbol is in a different DSO), the computation of the static TLS offset used the wrong DSO.
This would effectively mean the wrong address was computed (PR toolchain/50277, PR pkg/57445). Fix this by forcing the computation of the correct DSO (the one defining the symbol). This code uses __UNCONST to avoid the vast interface changes for this special case.
(2) If symbols from a DSO loaded via dlopen are used with both global-dynamic/local-dynamic and initial-exec relocations AND a initial-exec relocation was resolved first in a thread, a split brain situation could exist where the dynamic relocations would use one memory block (separate allocation) and the initial-exec relocations the static per-thread TLS space.
(3) If the initial-exec relocation in (2) is seen after any thread has already used a GD/LD allocation, bail out. Since IE relocations are used only in the GOT, this will prevent the dlopen. This is a bit more aggressive than necessary, but a full blown reference counting doesn't seem to be justified. Avoid using uninitialized variable "symnum" when building with DEBUG enabled by borrowing the rdbg_symname() macro from arch/x86_64. ld.elf_so: Sprinkle more debug messages on dlopen and error.
PR pkg/57445
Fix MKDEBUGLIB build by adding these installed files to the debug set list.
One could argue that these files are not of any use, so why install them? I don't have a good argument either way, and this is (for now) a simple work-around for PR bin/57455 Please feel free to commit a different fix to avoid installing these files at all.
Fix markup of libh_ MKDEBUGLIB=yes only files
TLS variant I archs need to fudge the offset by the size of the TCB. tests/libexec/ld.elf_so: Fix helper library makefiles. 1. Consolidate logic into a single helper.mk to reduce duplication. 2. Set NO* variables, not MK* variables which are reserved for user. 3. Avoid eager X!= in favour of lazy ${X:sh}. 4. Mark _g.a set list entries obsolete. Never should've been built! PR misc/57462
|
1.197.2.6 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1690):
libexec/ld.elf_so/rtld.c: revision 1.213
dlopen(3): Read _rtld_objtail under the lock.
|
1.197.2.5 |
| 01-Apr-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1624):
libexec/ld.elf_so/rtld.c: revision 1.212
ld.elf_so(8): Make fork take a shared, not exclusive, lock.
We only need to ensure that there are no concurrent modifications to the rtld data structures in flight, since the threads that began those modifications will not exist in the child and will therefore be unable to complete them in the child.
A shared lock suffices to ensure there are no such concurrent modifications in flight; an exclusive lock is not necessary, and can cause deadlock if fork is executed from a signal handler, which is explicitly allowed by POSIX (and our own sigaction(2) man page) which marks fork as async-signal-safe.
PR lib/56979
|
1.197.2.4 |
| 13-May-2020 |
martin | Pull up following revision(s) (requested by chs in ticket #907):
libexec/ld.elf_so/rtld.c: revision 1.205 libexec/ld.elf_so/rtld.h: revision 1.140 libexec/ld.elf_so/symbols.map: revision 1.3 libexec/ld.elf_so/symbols.map: revision 1.4 lib/libc/gen/pthread_atfork.c: revision 1.13 lib/libc/gen/pthread_atfork.c: revision 1.14 libexec/ld.elf_so/rtld.h: revision 1.139 libexec/ld.elf_so/rtld.c: revision 1.204
Introduce intermediate locking for fork, so that the dynamic linker is in a consistent state. This most importantly avoids races between dlopen and friends and fork, potentially resulting in dead locks in the child when it itself tries to acquire locks.
Rename __atomic_fork to __locked_fork and give it &errno as argument. rtld and libc use different storage, so the initial version would incorrectly report the failure reason for fork().
There is still a small race condition inside ld.elf_so as it doesn't use thread-safe errno internally, but that's a more contained internal issue.
|
1.197.2.3 |
| 08-Mar-2020 |
martin | Pull up following revision(s) (requested by thorpej in ticket #758):
libexec/ld.elf_so/map_object.c: revision 1.61 libexec/ld.elf_so/headers.c: revision 1.68 libexec/ld.elf_so/rtld.c: revision 1.203
PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends on a linker common page size boundary. However, if the common page size used by the linker is less than the VM page size being used by the kernel, this can end up in the middle of a VM page and when the region is write- protected, this can cause objects in neighboring .data to get incorrectly write-protected, resulting in a crash.
Avoid this situation by calculating the end of the RELRO region not by rounding memsz up to the VM page size, but rather by adding vaddr + memsz and then truncating to the VM page size.
Fixes PR toolchain/55043.
XXX pullup-9
|
1.197.2.2 |
| 09-Dec-2019 |
martin | Pull up following revision(s) (requested by uwe in ticket #534):
libexec/ld.elf_so/rtld.c: revision 1.201
_rtld_relro - fix debug printf format for a size_t argument
|
1.197.2.1 |
| 18-Sep-2019 |
martin | Pull up following revision(s) (requested by kamil in ticket #209):
libexec/ld.elf_so/rtld.c: revision 1.198
Return the ELF loader dl_phdr_info information for dl_iterate_phdr(3) Sync the behavior of dl_iterate_phdr(3) with Linux/FreeBSD/OpenBSD.
|
1.207.2.1 |
| 31-May-2021 |
cjep | sync with head
|
1.212.2.4 |
| 06-Aug-2024 |
snj | Pull up following revision(s) (requested by martin in ticket #775): libexec/ld.elf_so/rtld.c: 1.216 PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so local copy of the atomic access support functions for machines that do not implement all required ops in hardware (like 32bit sparc). XXX would be better to figure out a way to share this copy with libc (thereby using half as many RAS sections). But even if we would share it, we have to init it early enough for ld.elf_so internal uses.
|
1.212.2.3 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #300):
libexec/ld.elf_so/rtld.h: revision 1.145 libexec/ld.elf_so/symbol.c: revision 1.74 libexec/ld.elf_so/rtld.h: revision 1.147 libexec/ld.elf_so/symbol.c: revision 1.75 libexec/ld.elf_so/symbol.c: revision 1.76 tests/libexec/ld.elf_so/t_hash.c: revision 1.1 libexec/ld.elf_so/Makefile: revision 1.145 libexec/ld.elf_so/Makefile: revision 1.146 libexec/ld.elf_so/Makefile: revision 1.147 libexec/ld.elf_so/reloc.c: revision 1.118 distrib/sets/lists/tests/mi: revision 1.1280 libexec/ld.elf_so/rtld.c: revision 1.215 tests/libexec/ld.elf_so/Makefile: revision 1.21 libexec/ld.elf_so/hash.c: revision 1.1 libexec/ld.elf_so/hash.h: revision 1.1 distrib/sets/lists/debug/mi: revision 1.409
The SysV ABI specifies that the symbol hash function should return only 32 bits of hash. Unfortunately due to an implementation bug and the fact that the return type is unsigned long which is 64 bits in LP64, this can fail in some cases: "\xff\x0f\x0f\x0f\x0f\x0f\x12". See: "https://maskray.me/blog/2023-04-12-elf-hash-function From Ed Maste @ FreeBSD: https://cgit.freebsd.org/src/commit/?id=29e3a06510823edbb91667d21f530d3ec778116d
Need to write Unit Tests for this.
Oops wrong mask.
ld.elf_so: Split SRCS onto multiple lines. Makes updates easier. No functional change intended.
ld.elf_so: Sort SRCS. No functional change intended.
ld.elf_so: Split hash functions into a separate file. This way we can test them in isolation. No functional change intended.
ld.elf_so: Add some known-answer tests for hash functions.
Make sure the testing mechanism detects the traditional overflow bug.
|
1.212.2.2 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #297):
distrib/sets/lists/tests/shl.mi: revision 1.14 distrib/sets/lists/tests/shl.mi: revision 1.15 distrib/sets/lists/tests/shl.mi: revision 1.16 tests/libexec/ld.elf_so/helper_def_static/h_def_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.2 libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.75 distrib/sets/lists/tests/mi: revision 1.1265 libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.36 libexec/ld.elf_so/rtld.c: revision 1.214 tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.1 distrib/sets/lists/debug/mi: revision 1.400 tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.2 distrib/sets/lists/debug/mi: revision 1.401 distrib/sets/lists/debug/mi: revision 1.402 tests/libexec/ld.elf_so/helper_dso2/Makefile: revision 1.2 distrib/sets/lists/debug/mi: revision 1.403 tests/libexec/ld.elf_so/helper_symver_dso0/Makefile: revision 1.2 libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.48 distrib/sets/lists/debug/mi: revision 1.406 tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_ifunc_dso/Makefile: revision 1.2 libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.70 libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.18 tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/Makefile: revision 1.13 libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.46 libexec/ld.elf_so/rtld.h: revision 1.146 tests/libexec/ld.elf_so/Makefile: revision 1.14 distrib/sets/lists/debug/shl.mi: revision 1.306 tests/libexec/ld.elf_so/Makefile: revision 1.15 tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.1 distrib/sets/lists/debug/shl.mi: revision 1.307 tests/libexec/ld.elf_so/Makefile: revision 1.16 tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.2 distrib/sets/lists/debug/shl.mi: revision 1.308 tests/libexec/ld.elf_so/Makefile: revision 1.17 distrib/sets/lists/debug/shl.mi: revision 1.309 tests/libexec/ld.elf_so/Makefile: revision 1.18 tests/libexec/ld.elf_so/Makefile: revision 1.19 libexec/ld.elf_so/tls.c: revision 1.16 libexec/ld.elf_so/tls.c: revision 1.17 libexec/ld.elf_so/tls.c: revision 1.18 libexec/ld.elf_so/tls.c: revision 1.19 tests/libexec/ld.elf_so/helper_onlydef_static/h_onlydef_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.2 tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.2 libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.50 distrib/sets/lists/debug/shl.mi: revision 1.310 libexec/ld.elf_so/README.TLS: revision 1.6 distrib/sets/lists/debug/shl.mi: revision 1.311 distrib/sets/lists/debug/shl.mi: revision 1.314 tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_symver_dso1/Makefile: revision 1.4 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.63 tests/libexec/ld.elf_so/helper_def_dynamic/h_def_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.2 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.10 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.11 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.12 libexec/ld.elf_so/map_object.c: revision 1.66 tests/libexec/ld.elf_so/helper.mk: revision 1.1 libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.57 libexec/ld.elf_so/map_object.c: revision 1.67 tests/libexec/ld.elf_so/helper_onlydef/h_onlydef.c: revision 1.1 tests/libexec/ld.elf_so/helper_symver_dso2/Makefile: revision 1.4 tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.3 tests/libexec/ld.elf_so/helper_use_dynamic/h_use_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_abuse_static/h_abuse_static.c: revision 1.1 libexec/ld.elf_so/arch/riscv/mdreloc.c: revision 1.9 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.1 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.2 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.3 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.4 tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.5 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.6 libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.34 tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.7 libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.42 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.8 libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.43 libexec/ld.elf_so/arch/or1k/mdreloc.c: revision 1.4 tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.9 tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.2 tests/libexec/ld.elf_so/helper_abuse_dynamic/h_abuse_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlyctor_dynamic/h_onlyctor_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_static/h_onlyuse_static.c: revision 1.1 tests/libexec/ld.elf_so/helper_onlyuse_dynamic/h_onlyuse_dynamic.c: revision 1.1 tests/libexec/ld.elf_so/helper_dso1/Makefile: revision 1.2 distrib/sets/lists/tests/shl.mi: revision 1.12 distrib/sets/lists/tests/shl.mi: revision 1.13 libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.44 (all via patch)
ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.
ld.elf_so: Fix extern TLS test to match PR toolchain/50277. Now it's actually testing the problem. ld.elf_so: Nix inadvertently committed private test program. ld.elf_so: Fix set lists for MKDEBUG=yes builds with t_tls_extern.
ld.elf_so: Sprinkle tls debug messages.
ld.elf_so: Make tls alloc debug messages more detailed and greppable.
ld.elf_so: Test variations on PR toolchain/50277.
ld.elf_so: Test extern dynamic TLS too.
ld.elf_so: Factor out logic in TLS tests to make writing more easier. No functional change intended.
ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.
ld.elf_so: Shorter test names. No functional non-cosmetic change intended.
ld.elf_so: Separately test eager and lazy resolution of def tls ptr. eager: before loading use library lazy: after loading use library
Add recent ld.elf_so test helpers debug info ld.elf_so: Add new files to debug/shl.mi.
ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently. If a symbol has already been resolved as dynamic TLS, any library that tries to use it as static TLS cannot be dlopened.
ld.elf_so: Test another edge case of mismatched TLS models. One library defines a symbol and _doesn't_ use it, so it has no indication of whether the symbol is for static TLS or dynamic TLS, and then two other libraries use it in different ways.
ld.elf_so: Test dynamic-then-static abuse via ctor.
ld.elf_so: Fix missing tab in debug/shl.mi in last change.
Fix interactions of initial-exec TLS model and dlopen (1) If an initial-exec relocation was used for a non-local symbol (i.e. the definition of the symbol is in a different DSO), the computation of the static TLS offset used the wrong DSO. This would effectively mean the wrong address was computed (PR toolchain/50277, PR pkg/57445). Fix this by forcing the computation of the correct DSO (the one defining the symbol). This code uses __UNCONST to avoid the vast interface changes for this special case. (2) If symbols from a DSO loaded via dlopen are used with both global-dynamic/local-dynamic and initial-exec relocations AND a initial-exec relocation was resolved first in a thread, a split brain situation could exist where the dynamic relocations would use one memory block (separate allocation) and the initial-exec relocations the static per-thread TLS space. (3) If the initial-exec relocation in (2) is seen after any thread has already used a GD/LD allocation, bail out. Since IE relocations are used only in the GOT, this will prevent the dlopen. This is a bit more aggressive than necessary, but a full blown reference counting doesn't seem to be justified. Avoid using uninitialized variable "symnum" when building with DEBUG enabled by borrowing the rdbg_symname() macro from arch/x86_64. ld.elf_so: Sprinkle more debug messages on dlopen and error. PR pkg/57445 Fix MKDEBUGLIB build by adding these installed files to the debug set list. XXX One could argue that these files are not of any use, so why install them? I don't have a good argument either way, and this is (for now) a simple work-around for PR bin/57455 Please feel free to commit a different fix to avoid installing these files at all. Fix markup of libh_ MKDEBUGLIB=yes only files TLS variant I archs need to fudge the offset by the size of the TCB. tests/libexec/ld.elf_so: Fix helper library makefiles. 1. Consolidate logic into a single helper.mk to reduce duplication. 2. Set NO* variables, not MK* variables which are reserved for user. 3. Avoid eager X!= in favour of lazy ${X:sh}. 4. Mark _g.a set list entries obsolete. Never should've been built! PR misc/57462
|
1.212.2.1 |
| 01-Aug-2023 |
martin | Pull up following revision(s) (requested by riastradh in ticket #288):
libexec/ld.elf_so/rtld.c: revision 1.213
dlopen(3): Read _rtld_objtail under the lock.
|
1.217.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|