Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src
Module Name: src
Committed By: riastradh
Date: Wed Apr 16 01:56:53 UTC 2025
Modified Files:
src/libexec/ld.elf_so: headers.c
src/sys/arch/mips/include: elf_machdep.h
src/tests/libexec/ld.elf_so: t_rtld_r_debug.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/libexec/ld.elf_so/headers.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/include/elf_machdep.h
cvs rdiff -u -r1.10 -r1.11 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index