Home | History | Annotate | Download | only in ld.elf_so
History log of /src/tests/libexec/ld.elf_so/t_rtld_r_debug.c
RevisionDateAuthorComments
 1.12  16-Apr-2025  riastradh t_rtld_r_debug: Break once we've found DT_MIPS_RLD_MAP_REL.

No need to keep searching at that point (though maybe it wouldn't
hurt to verify that if we have both DT_MIPS_RLD_MAP and
DT_MIPS_RLD_MAP_REL, they agree).

PR port-mips/59296: t_rtld_r_debug test is failing
 1.11  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.10  15-Apr-2025  riastradh t_rtld_r_debug: Fix xfail on mips.

There was an earlier assertion, oops.

Add __RCSID while here.

PR port-mips/59296: t_rtld_r_debug test is failing
 1.9  14-Apr-2025  riastradh t_rtld_r_debug: Mark this xfail on mips.

PR port-mips/59296: t_rtld_r_debug test is failing
 1.8  12-Apr-2025  riastradh t_rtld_r_debug: Print some diagnostics as we go.
 1.7  12-Apr-2025  riastradh t_rtld_r_debug: Use ATF_REQUIRE where we can't proceed on failure.

Not helpful for the test program to crash with SIGSEGV on null
pointer dereference -- just make it stop when we detect the null
pointer.
 1.6  08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.5  24-Nov-2023  riastradh branches: 1.5.2;
t_dlinfo, t_rtld_r_debug: Audit ATF_REQUIRE/CHECK, sprinkle messages.

Make sure to use ATF_REQUIRE when the subsequent code doesn't work if
the check fails.
 1.4  24-Nov-2023  riastradh rtld tests: Don't use RZ for dlinfo.

Use

ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror())

instead, in order to accurately report the error on failure. RZ is
only for functions like pthread_create(3) that return zero on success
and errno(3) code on failure, but dlinfo returns -1 on failure and
sets dlerror() to report the nature of the error.
 1.3  29-Sep-2020  roy Whitespace
 1.2  29-Sep-2020  roy Fix build with clang.
 1.1  22-Sep-2020  kamil Add new RTLD test file for r_debug

New tests:
- self
- dlopen

Both check whether the r_debug structure seems to be well-formed, without
and with a dlopen(3) call.
 1.5.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed