History log of /src/tests/libexec/ld.elf_so/t_dladdr.c
Revision Date Author Comments
# 1.2 15-Dec-2025 riastradh

branches: 1.2.2;
dladdr(3): Fix determination of object address intervals.

This appears to have been broken in rev. 1.62 back in 2017 with a
change to compute the largest distance from the first LOAD segment's
starting address to the maximum address of any LOAD segment -- we
started by finding the distance from _zero_ to the maximum address of
the first LOAD segment because we subtracted obj->vaddrbase which
wasn't initialized yet, so we would overshoot obj->mapsize and
obj->textsize by whatever the value of obj->vaddrbase turned out to
be.

XXX The commit message for 1.62 suggests we are dropping the
assumption that the LOAD segments appear in order. But it looks to
me like we still assume the _first_ load segment has the lowest
virtual address, because we keep it as obj->vaddrbase/obj->mapbase
and use it as a reference point for measuring the size of an object
by subtracting it from each load segment's maximum address. Is the
original assumption that LOAD segments appear in order valid after
all, or do we need to do extra work here to handle objects whose LOAD
segments are so much out of order that the first LOAD segment isn't
lowest in virtual address space? Unclear!

Might help with wine.

Based on a patch by Akihiro Sagawa, thanks!

PR lib/59567: dladdr(3) doesn't work properly especially when main
executable is loaded at high memory address


# 1.1 14-Dec-2025 riastradh

dl_addr(3): Add some automatic tests.

XXX Should also test the libc stubs, maybe move this into
tests/lib/libc/dlfcn and test both static and (for MKPIC=yes)
dynamic, but this'll do for now.

PR lib/59567: dladdr(3) doesn't work properly especially when main
executable is loaded at high memory address