History log of /src/tests/libexec/ld.elf_so/Makefile
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.35 21-Dec-2025 riastradh

tests/libexec/ld.elf_so/t_r_rel: Make sure helper is compiled as PIE.

Otherwise this test doesn't work: the whole point is to check for
relative relocations, which are only used in position-independent
code.

Should fix the test on platforms that don't do PIE by default like
alpha and sparc64.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.34 18-Dec-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Undo recent -Wl,-Map change.

This was almost certainly a mistake in a commit that was otherwise
entirely about omap4/pandaboard support:

https://mail-index.NetBSD.org/source-changes/2025/12/16/msg159556.html

The change added LDADD linker arguments of the form

-Wl,-Map foo.map

except that doesn't actually pass `-Map foo.map' through to the
underlying linker -- it only passes `-Map' to the linker, and then
treats `foo.map' as an extra input file for another object to link
(which doesn't work because the file doesn't exist). If we want to
keep this change (not sure why), then we would have to use

-Wl,-Map,foo.map

to actually pass `-Map foo.map' through to the underlying linker.

Should fix clang build failures:

aarch64--netbsd-clang: error: no such file or directory: 't_ifunc.map'
--- t_ifunc.link ---

*** Failed target: t_ifunc.link
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc.link
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-tools/bin/aarch64--netbsd-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -Wl,-z,relro -pie -o t_ifunc.link t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-Map t_ifunc.map -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc.link t_ifunc.o
*** [t_ifunc.link] Error code 1


# 1.33 17-Dec-2025 riastradh

tests/lib/csu, tests/libexec/ld.elf_so: Apply CTFMERGE=: workaround.

The workaround for

PR toolchain/59364: ctf tools needs update

required an update after fixing

PR toolchain/57241: mips64el--netbsd-install core dumps randomly

by splitting the recipes for ${PROG} and ${PROG}.debug into an
intermediate ${PROG}.link to avoid overwriting ${PROG} inside the
recipe for ${PROG}.debug.

This is kludgey (writing the `.link' suffix into a Makefile isn't
great) but I see only two cases of it so this'll do for now.


# 1.32 16-Dec-2025 skrll

Pandaboard work from Rui-Xiang Guo via port-arm with updates from me.

https://github.com/picohive/netbsd-pandaboard


# 1.31 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


# 1.30 06-Dec-2025 skrll

Add a testcase for PR/59652.


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

branches: 1.28.2;
centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()


# 1.34 18-Dec-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Undo recent -Wl,-Map change.

This was almost certainly a mistake in a commit that was otherwise
entirely about omap4/pandaboard support:

https://mail-index.NetBSD.org/source-changes/2025/12/16/msg159556.html

The change added LDADD linker arguments of the form

-Wl,-Map foo.map

except that doesn't actually pass `-Map foo.map' through to the
underlying linker -- it only passes `-Map' to the linker, and then
treats `foo.map' as an extra input file for another object to link
(which doesn't work because the file doesn't exist). If we want to
keep this change (not sure why), then we would have to use

-Wl,-Map,foo.map

to actually pass `-Map foo.map' through to the underlying linker.

Should fix clang build failures:

aarch64--netbsd-clang: error: no such file or directory: 't_ifunc.map'
--- t_ifunc.link ---

*** Failed target: t_ifunc.link
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc.link
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-tools/bin/aarch64--netbsd-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -Wl,-z,relro -pie -o t_ifunc.link t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-Map t_ifunc.map -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-aarch64/20251217070550Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc.link t_ifunc.o
*** [t_ifunc.link] Error code 1


# 1.33 17-Dec-2025 riastradh

tests/lib/csu, tests/libexec/ld.elf_so: Apply CTFMERGE=: workaround.

The workaround for

PR toolchain/59364: ctf tools needs update

required an update after fixing

PR toolchain/57241: mips64el--netbsd-install core dumps randomly

by splitting the recipes for ${PROG} and ${PROG}.debug into an
intermediate ${PROG}.link to avoid overwriting ${PROG} inside the
recipe for ${PROG}.debug.

This is kludgey (writing the `.link' suffix into a Makefile isn't
great) but I see only two cases of it so this'll do for now.


# 1.32 16-Dec-2025 skrll

Pandaboard work from Rui-Xiang Guo via port-arm with updates from me.

https://github.com/picohive/netbsd-pandaboard


# 1.31 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


# 1.30 06-Dec-2025 skrll

Add a testcase for PR/59652.


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()


# 1.33 17-Dec-2025 riastradh

tests/lib/csu, tests/libexec/ld.elf_so: Apply CTFMERGE=: workaround.

The workaround for

PR toolchain/59364: ctf tools needs update

required an update after fixing

PR toolchain/57241: mips64el--netbsd-install core dumps randomly

by splitting the recipes for ${PROG} and ${PROG}.debug into an
intermediate ${PROG}.link to avoid overwriting ${PROG} inside the
recipe for ${PROG}.debug.

This is kludgey (writing the `.link' suffix into a Makefile isn't
great) but I see only two cases of it so this'll do for now.


# 1.32 16-Dec-2025 skrll

Pandaboard work from Rui-Xiang Guo via port-arm with updates from me.

https://github.com/picohive/netbsd-pandaboard


# 1.31 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


# 1.30 06-Dec-2025 skrll

Add a testcase for PR/59652.


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()


# 1.32 16-Dec-2025 skrll

Pandaboard work from Rui-Xiang Guo via port-arm with updates from me.

https://github.com/picohive/netbsd-pandaboard


# 1.31 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


# 1.30 06-Dec-2025 skrll

Add a testcase for PR/59652.


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()


# 1.31 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


# 1.30 06-Dec-2025 skrll

Add a testcase for PR/59652.


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()


# 1.30 06-Dec-2025 skrll

Add a testcase for PR/59652.


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()


# 1.29 23-Nov-2025 riastradh

ld.elf_so(1): Test concurrent dlopen/dlclose.

PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
# 1.28 10-Jun-2025 christos

centralize pack-relative-relocs handling


# 1.27 02-May-2025 riastradh

ld.elf_so: Add a trivial test for R_*_RELATIVE relocations.

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.26 27-Apr-2025 riastradh

tests/libexec/ld.elf_so/Makefile: Sort.

Preparation for:

PR bin/59360: ld.elf_so(8): missing RELR support


# 1.25 16-Apr-2025 riastradh

t_rtld_r_debug: Test this as a non-PIE executable too.

On MIPS, non-PIEs can use DT_MIPS_RLD_MAP or DT_MIPS_RLD_MAP_REL,
while PIEs can't use DT_MIPS_RLD_MAP because it relies on an absolute
virtual address baked into the file. So it's important to test both.

PR port-mips/59296: t_rtld_r_debug test is failing


# 1.24 22-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no harder.

Don't even pass -Wl,-z,norelro if MKRELRO=no, because the toolchain's
ld(1) might not support relro _or_ norelro.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407182350Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z norelro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc_norelro ---
*** Failed target: t_ifunc_norelro
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
...


# 1.23 16-Jul-2024 riastradh

tests/libexec/ld.elf_so/t_ifunc: Handle MKRELRO=no.

Just build t_ifunc and t_ifunc_now normally. If they wind up being
built with the same options as t_ifunc_norelro and
t_ifunc_norelro_now, so be it; easier to do it this way than to put
more conditionals into set lists.

Should resolve, e.g.:

/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-ld: warning: -z relro ignored
armv7--netbsdelf-eabihf-clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- t_ifunc ---
*** Failed target: t_ifunc
*** In directory: /home/source/ab/HEAD-llvm/src/tests/libexec/ld.elf_so
*** Failed commands:
${_MKTARGET_LINK}
=> @# " link " ld.elf_so/t_ifunc
${_CCLINK.${:Ut_ifunc}} ${_LDFLAGS.${:Ut_ifunc}} ${_LDSTATIC.${:Ut_ifunc}} -o ${.TARGET} ${OBJS.${:Ut_ifunc}} ${_PROGLDOPTS} ${_LDADD.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/armv7--netbsdelf-eabihf-clang --sysroot=/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest -Wl,--fatal-warnings -Wl,--warn-shared-textrel -pie -o t_ifunc t_ifunc.o -Wl,-rpath-link,/home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-dest/lib -L=/lib -Wl,-z,relro -Wl,-rpath,/usr/tests/libexec/ld.elf_so -lutil -latf-c
${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${:Ut_ifunc}}
=> /home/builds/ab/HEAD-llvm/evbarm-earmv7hf/202407141900Z-tools/bin/nbctfmerge -t -g -L VERSION -g -o t_ifunc t_ifunc.o


# 1.22 07-Jul-2024 riastradh

t_ifunc: Test with all combinations of {relro, bindnow}.

PR lib/57792


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
# 1.21 30-Jul-2023 riastradh

branches: 1.21.2;
ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


# 1.20 03-Jun-2023 lukem

adapt to ${CC_WNO_MAYBE_UNINITIALIZED}

Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.


# 1.19 02-Jun-2023 riastradh

ld.elf_so: Test dynamic-then-static abuse via ctor.

XXX pullup-10


# 1.18 02-Jun-2023 riastradh

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.

XXX pullup-10


# 1.17 01-Jun-2023 riastradh

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

XXX pullup-10


# 1.16 01-Jun-2023 riastradh

ld.elf_so: Test extern dynamic TLS too.

XXX pullup-10


# 1.15 31-May-2023 riastradh

ld.elf_so: Nix inadvertently committed private test program.


# 1.14 31-May-2023 riastradh

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.


# 1.13 31-May-2023 riastradh

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

XXX pullup-10


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1
# 1.12 30-May-2021 joerg

branches: 1.12.4;
Drop explicit -msecure-plt, it's the default for both clang and gcc.


Revision tags: cjep_staticlib_x-base
# 1.11 22-Sep-2020 kamil

branches: 1.11.2;
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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.10 14-May-2019 christos

branches: 1.10.2;
clang ifunc's on powerpc require secure-plt.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base
# 1.9 11-Jul-2017 joerg

branches: 1.9.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.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.8 25-Aug-2014 joerg

branches: 1.8.8;
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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.7 03-Jul-2011 mrg

avoid building stuff that depends upon pic objects if MKPIC == no.


# 1.6 03-Jul-2011 mrg

only build the ld.elf_so tests if MKPIC != no.


# 1.5 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: cherry-xenmp-base
# 1.4 31-Mar-2011 joerg

Add initial regression test for ld.elf_so locking.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.3 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.2 14-Dec-2010 skrll

Convert a couple of old regress tests to ATF.

Remove the regress/usr.bin/rtld/dlopen/dlopen.c test as well as it's
covered by existing ATF test(s).


Revision tags: matt-premerge-20091211
# 1.1 24-Sep-2009 pooka

add regression tests for dlinfo()