Home | History | Annotate | Download | only in ld.elf_so
History log of /src/libexec/ld.elf_so/headers.c
RevisionDateAuthorComments
 1.75  02-May-2025  riastradh ld.elf_so: Implement RELR relocations.

The SHT_RELR-type .relr.dyn section, pointed to by the DT_RELR
dynamic tag, holds compressed R_*_RELATIVE-type relocations,
substantially reducing the disk space occupied by many programs.

This commit adds support in ld.elf_so for relocating dynamically
linked executables with RELR relocations.

Reference:

Rahul Chaudhry, `Re: Proposal for a new section type SHT_RELR',
generic-abi mailing list, 2018-02-07.

https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/Jnz1lgLJAgAJ
https://web.archive.org/web/20241213012330/https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/Jnz1lgLJAgAJ

Proposed on tech-userlevel:
https://mail-index.NetBSD.org/tech-userlevel/2025/04/27/msg014727.html

PR bin/59360: ld.elf_so(8): missing RELR support
 1.74  18-Apr-2025  riastradh ld.elf_so on alpha: Add support for secureplt.

ok thorpej

PR port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
PR port-alpha/57717: Alpha linker generates LOAD segments (and
generates warnings about them)
 1.73  16-Apr-2025  riastradh ld.elf_so: Teach this to handle MIPS PIE rtld debug data.

Adapt t_rtld_r_debug to handle the two MIPS cases too.

XXX t_rtld_r_debug should be tested both as PIE and non-PIE to
exercise both cases.

Context:

The value of a DT_DEBUG .dynamic entry is initialized at load-time,
by ld.elf_so, to a pointer to a data structure set up by ld.elf_so
describing the shared objects loaded by the executable, so debuggers
can find them from, e.g., core dumps. None of this is really
documented anywhere that I can find. Best reference is this post on
the gdb mailing list from a quarter century ago saying there's no
real documentation:

https://web.archive.org/web/20250414021320/https://sourceware.org/pipermail/gdb/2000-April/004509.html

However, on MIPS, the .dynamic section is mapped read-only, so
ld.elf_so can't properly modify it (I imagine technically it could
with some mprotect shenanigans but that's not how it's done on MIPS).
Instead, the linker reserves a location in read/write memory and uses
a DT_MIPS_RLD_MAP entry with a pointer to that location.

However, in position-independent executables, the .dynamic entry
can't have an absolute pointer to that location because it's not
known up front. Instead, the the linker uses a DT_MIPS_RLD_MAP_REL
entry with the relative offset to that location from the Elf_Dyn
entry itself.

I would add a reference for this but it's basically a matter of UTSL
plus some oblique mentions on the web and mailing list discussions:

https://web.archive.org/web/20250414024823/https://cygwin.com/legacy-ml/binutils/2016-04/msg00244.html
https://web.archive.org/web/20250403151803/https://maskray.me/blog/2023-09-04-toolchain-notes-on-mips
https://web.archive.org/web/20211024050833/https://reviews.llvm.org/D12794?id=34533
https://web.archive.org/web/20250407052145/https://wiki.debian.org/MIPSPort
https://web.archive.org/web/20250414024924/https://reviews.freebsd.org/D17867?id=50122

PR port-mips/59296: t_rtld_r_debug test is failing
 1.72  03-Aug-2024  riastradh ld.elf_so(1): Nix trailing whitespace.

No functional change intended.
 1.71  04-Jan-2023  christos comment out a function that is only used in rtld
 1.70  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.69  16-May-2020  skrll Fix debug build
 1.68  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.67  29-Feb-2020  kamil Add extra cast to suppress incompatible-pointer-types GCC warning
 1.66  29-Feb-2020  kamil Implement DT_GNU_HASH

DT_GNU_HASH serves the same purpose as DT_HASH, however it is a distinct
and faster apprach implemented and designed in the GNU toolchain in 2006.

DT_GNU_HASH is preferred whenever available.

Original GNU benchmarks claim 50% faster dynamic linking time.
https://www.sourceware.org/ml/binutils/2006-06/msg00418.html

Code based on FreeBSD and OpenBSD, both were based on DragonFlyBSD.
 1.65  30-Dec-2018  martin branches: 1.65.2;
Add support for DT_RUNPATH - it is just the same as we always have treated
DT_RPATH. Approved by core.
 1.64  24-Jul-2018  joerg Apply relocbase for tlsinit of the executable itself. Fixes PIE where
relocbase typically is not zero.

PR bin/53465
 1.63  24-May-2018  christos branches: 1.63.2;
rename flag to the official name.
 1.62  23-Jun-2017  joerg branches: 1.62.4;
Remove old assert that only two segments exist. The rest of the code has
been changed to cope with more and at least Go actively creates them.
Adjust the mapping size computation to use the maximum and not depend on
PT_LOAD segments to be in order.
 1.61  14-Jun-2016  christos branches: 1.61.8;
Add support for GNU RELRO headers from Matthias Weckbecker.
 1.60  22-May-2016  joerg obj->phdr must be the absolute address, not the virtual offset from the
main binary. Historically, this has been the same. For PIE though,
relocbase can be pretty much anywhere. Fixes PR toolchain/51159.
 1.59  26-Aug-2014  joerg Restore parenthesis to cast in the right order.
 1.58  26-Aug-2014  christos fix set but not used.
 1.57  26-Aug-2014  joerg Go back to skipping init/fini handling for ldd, makes problems for 32bit
compat on LP64.
 1.56  26-Aug-2014  christos Introduce a cast to fix the build for Elf32 on _LP64.
 1.55  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.54  07-Mar-2014  matt branches: 1.54.4;
Make ldd happy
 1.53  06-Mar-2014  matt More PPC64 changes.
Nothing to do for lazy bindings.
Record DT_PPC64_GLINK and make _rtld_bind return it.
When resolving a JMP_SLOT, copy the source function descriptor into the PLTGOT
 1.52  03-Aug-2013  skrll Fix DEBUG build.
 1.51  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.50  06-May-2013  skrll Trailing whitespace
 1.49  06-May-2013  skrll Add some DEBUG code.
 1.48  02-May-2013  matt Print out PT_DYNAMIC address for objmain.
Print out &_DYNAMIC too.
 1.47  25-Apr-2013  matt Use phdr as start of phdrs (duh)
 1.46  25-Apr-2013  matt Use ph, not phdr, consistently.
 1.45  25-Apr-2013  matt Don't assume that PT_PHDR is always first.
 1.44  24-Apr-2013  matt Add support for PT_ARM_EXIDX and __gnu_Unwind_Find_exidx for libgcc's support
of the ARM EHABI.
 1.43  15-Aug-2012  matt branches: 1.43.2;
Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).
 1.42  22-Jul-2012  martin Remove a debug assert that does not hold for PIE (e.g. phdr = 0x40, but
obj has not been mapped at 0, so obj->phdr is 0x100040).
OK: skrll
 1.41  25-Jun-2011  nonaka branches: 1.41.2; 1.41.4;
PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.
 1.40  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.39  16-Jan-2011  matt Add secure-plt support for powerpc to ld.elf_so. As part of this, we have to
stop calling into the GOT/_DYNAMIC since they are no longer executable.
 1.38  24-Dec-2010  skrll 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.37  16-Oct-2010  skrll Add cast so that usr.bin/ldd/elf32 builds.
 1.36  16-Oct-2010  skrll Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.
 1.35  15-Oct-2010  skrll Revert previous for now. It's part of a larger commit which will arrive
soon.
 1.34  15-Oct-2010  skrll Be more tolerant to the location of PT_PHDR in the segment list.
 1.33  30-Sep-2010  skrll Oops. Remove trailing whitespace in previous.
 1.32  30-Sep-2010  skrll Improve debug output.
 1.31  30-Sep-2010  skrll Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.
 1.30  23-Sep-2010  joerg Avoid casting from d_val to plttype of different signedness.
Just two booleans for the same purpose.
 1.29  05-Apr-2010  joerg Use fast_remainder32 for the ELF hash. For the hot cache case, this
speeds up Firefox startup by over 2% on AMD64.
Limit hash table buckets to 32bit.
 1.28  12-Apr-2009  lukem Fix const issues (cast const pointers to "const uint8_t *" instead of "caddr_t")
 1.27  06-Jan-2009  mrg branches: 1.27.2;
add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
*and _LP64. necessary for 32/64 bit combo ldd support.
 1.26  29-Dec-2007  christos branches: 1.26.10;
make this compile again.
 1.25  28-Dec-2007  christos simplify; mapbase == vaddrbase from the PaX author.
 1.24  26-Dec-2007  christos Deal with ASLR PIE executables, by recognizing that phdr != phdr->v_addr
for PT_PHDR headers when the program has been loader to a vaddr other than
then one specified (a randomized one), and modifying the relocation base
address appropriately (idea from elad)
 1.23  07-Dec-2007  ad 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.22  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.21  18-May-2007  christos branches: 1.21.4;
Support Solaris-like $ORIGIN etc. expansions in paths.
 1.20  09-Jan-2005  simonb Don't process DT_DEBUG on MIPS as the dynamic section is mapped
read-only. DT_MIPS_RLD_MAP is used instead.

Patch from Nick Hudson.
 1.19  22-Oct-2004  skrll Add __RCSIDs.

OK'd by mycroft.
 1.18  24-Jul-2003  skrll ANSIfy and de-__P().
 1.17  05-Oct-2002  mycroft Minor cleanup.
 1.16  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.15  26-Sep-2002  mycroft Don't bogusly set obj->pltrela{,lim} if there is no DT_PLTREL.
 1.14  25-Sep-2002  mycroft #if defined -> #ifdef
 1.13  13-Sep-2002  mycroft Figure out obj->pltrel(a) after the dynamic section is parsed, so the relative
order of DT_PLTREL and DT_JMPREL is irrelevant. Removes the need for yet
another weird #ifdef.
Also, be slightly more careful with the rel(a)lim trimming.
 1.12  12-Sep-2002  mycroft Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit.
 1.11  05-Sep-2002  mycroft If REL(A)SZ extends into .rel(a).plt, trim rel(a)lim. This is actually due to
what is arguably a bug in BFD on some platforms (at least PPC and SPARC), but
I can't fix old binaries.
 1.10  10-Jul-2002  fredette Add support for dynamic linking on HP PA-RISC.
 1.9  25-Apr-2001  kleink branches: 1.9.2;
Sync with <sys/exec_elf.h> rev. 1.45: ElfNN_RelA -> ElfNN_Rela.
 1.8  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.7  18-Jul-2000  eeh Fix some issues with SPARC V9 ELF binaries.
 1.6  07-Nov-1999  mycroft branches: 1.6.4;
Changes from msaitoh to fix local/global symbol confusion, and to fix weak
symbol support -- updated by me for elf.h changes.
 1.5  25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.4  01-Mar-1999  christos branches: 1.4.4;
KNF
 1.3  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.2  25-Mar-1998  mhitch Add support for mips.
 1.1  16-Dec-1996  cgd branches: 1.1.2;
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.1.2.1  08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.4.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.2  01-May-2001  he Pull up revision 1.9 (requested by kleink):
Rename ElfNN_RelA to ElfNN_Rela, which is what SVR4 ABIs and the
rest of the world uses. Fixes PR#12274.
 1.6.4.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.9.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.21.4.2  09-Jan-2008  matt sync with HEAD
 1.21.4.1  06-Nov-2007  matt sync with HEAD
 1.26.10.3  18-Mar-2012  bouyer Apply patch, requested by skrll in ticket 1724:
libexec/ld.elf_so/headers.c 1.37 via patch
Add cast so that usr.bin/ldd/elf32 builds.
 1.26.10.2  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.26.10.1  16-Jan-2009  bouyer Pull up following revision(s) (requested by mrg in ticket #265):
libexec/ld.elf_so/headers.c: revision 1.27
rescue/list: revision 1.35
libexec/ld.elf_so/arch/sparc/Makefile.ld32: revision 1.1
usr.bin/ldd/Makefile.elf: revision 1.1
usr.bin/ldd/Makefile.elf: revision 1.2
usr.bin/ldd/ldd_aout/ldd.c: file removal
usr.bin/ldd/Makefile.elf: revision 1.3
libexec/ld.elf_so/arch/sparc/Makefile.inc: revision 1.12
usr.bin/ldd/dummy.c: revision 1.1
gnu/usr.bin/binutils/ld/Makefile: revision 1.28
usr.bin/ldd/elf32/Makefile: revision 1.1
usr.bin/ldd/elf32/Makefile: revision 1.2
usr.bin/ldd/ldd.c: revision 1.3
usr.bin/ldd/elf32/Makefile: revision 1.3
usr.bin/ldd/ldd_elf/Makefile: file removal
usr.bin/ldd/ldd.h: revision 1.1
usr.bin/ldd/ldd.c: revision 1.4
usr.bin/ldd/ldd_aout.c: revision 1.1
usr.bin/ldd/Makefile: revision 1.8
usr.bin/ldd/Makefile: revision 1.9
usr.bin/ldd/ldd_elfxx.c: revision 1.1
libexec/ld.elf_so/map_object.c: revision 1.37
usr.bin/ldd/ldd_aout/Makefile: file removal
usr.bin/ldd/elf64/Makefile: revision 1.1
rescue/Makefile: revision 1.22
libexec/ld.elf_so/arch/i386/Makefile.ld32: revision 1.1
usr.bin/ldd/ldd_elf/ldd.c: file removal
usr.bin/ldd/elf64/Makefile: revision 1.2
usr.bin/ldd/elf64/Makefile: revision 1.3
usr.bin/ldd/aout/Makefile: revision 1.1
libexec/ld.elf_so/arch/i386/Makefile.inc: revision 1.12
rescue/list.ldd: revision 1.1
usr.bin/ldd/ldd_elf/README: file removal
usr.bin/ldd/Makefile.common: revision 1.1
move the defines for RTLD_ARCH_SUBDIR into a sub-sub-makefile so we can
grab these values via reach-over more easily.
some fixes for PR#40170:
- set NATIVE=yes in the environment for genscripts.sh
- set LIB_PATH to /usr/lib/{sparc,i386} for those scripts
- set use_sysroot to "yes", to enable LIB_PATH to work in genscripts.sh
- get rid of building an a.out-happy ldd (but keep supporting a.out
binaries for the ELF version.)
- convert a.out, elf32 and elf64 support into convience libraries and
link them right ones in. if elf_ldd() fails on 64 bit platforms,
try elf32_ldd() before aout_ldd().
now ldd on 64 bit platforms works for 32 bit binaries, aka PR#40199,
and it seems that all the issues from README are gone too.
add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
*and _LP64. necessary for 32/64 bit combo ldd support.
- rework this a bunch to make it work inside /rescue/ldd.
- fix alpha build.
make sure we set LIBISPRIVATE.
fixes build issues reported by moof.
make sure we set LIBISPRIVATE.
fixes build issues reported by moof.
 1.27.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.41.4.1  08-Aug-2012  jdc branches: 1.41.4.1.2;
Pull up revisions:
src/libexec/ld.elf_so/headers.c revision 1.42
src/libexec/ld.elf_so/arch/sparc64/mdreloc.c revision 1.53
(requested by martin in ticket #447).

Remove a debug assert that does not hold for PIE (e.g. phdr = 0x40, but
obj has not been mapped at 0, so obj->phdr is 0x100040).
OK: skrll

Add special handling needed for OLO10 relocations.
First part of fixing PR port-sparc64/46724.
 1.41.4.1.2.1  22-Jan-2013  matt Pullup from HEAD:
Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).
 1.41.2.2  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.41.2.1  30-Oct-2012  yamt sync with head
 1.43.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.2.1  23-Jun-2013  tls resync from head
 1.54.4.1  06-Mar-2016  martin Catch up to -current, via patch, requested by christos in ticket #1126:
 1.61.8.2  26-Jul-2018  snj Pull up following revision(s) (requested by joerg in ticket #940):
libexec/ld.elf_so/headers.c: revision 1.64
Apply relocbase for tlsinit of the executable itself. Fixes PIE where
relocbase typically is not zero.
PR bin/53465
 1.61.8.1  30-Jun-2017  snj Pull up following revision(s) (requested by joerg in ticket #63):
libexec/ld.elf_so/headers.c: revision 1.62
Remove old assert that only two segments exist. The rest of the code has
been changed to cope with more and at least Go actively creates them.
Adjust the mapping size computation to use the maximum and not depend on
PT_LOAD segments to be in order.
 1.62.4.3  18-Jan-2019  pgoyette Synch with HEAD
 1.62.4.2  28-Jul-2018  pgoyette Sync with HEAD
 1.62.4.1  25-Jun-2018  pgoyette Sync with HEAD
 1.63.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.63.2.1  10-Jun-2019  christos Sync with HEAD
 1.65.2.1  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

RSS XML Feed