Created attachment 15021 [details] ld.log.xz Originally reported downstream in Gentoo at https://bugs.gentoo.org/885617 but I can reproduce it myself now. ``` $ grep FAIL: /var/tmp/portage/sys-devel/binutils-2.41/temp/build.log FAIL: tmpdir/gp-collect-app_F FAIL: --only-keep-debug for ELF relocatables FAIL: Run pr23169b ``` (I'll file other bugs for the other 2 failures, so just worrying about 'Run pr23169b' here.) From `ld.log`: ``` Running: tmpdir/pr23169b > tmpdir/pr23169b.out tmpdir/pr23169b: IFUNC symbol 'func' referenced in 'tmpdir/libpr23169a.so' is defined in the executable and creates an unsatisfiable circular dependency. FAIL: Run pr23169b x86_64-pc-linux-gnu-gcc -B/var/tmp/portage/sys-devel/binutils-2.41/work/build/ld/tmpdir/ld/ -I/var/tmp/portage/sys-devel/binutils-2.41/work/binutils-2.41/ld/testsuite/ld-ifunc -g -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -c -fno-lto -fPIE -O2 -g -c /var/tmp/portage/sys-devel/binutils-2.41/work/binutils-2.41/ld/testsuite/ld-ifunc/pr23169b.c -o tmpdir/pr23169b.o ``` ``` $ ld.so --version | head -1 ld.so (Gentoo 2.37-r4 (patchset 6)) stable release version 2.37. ```
Is lazy binding disabled by default?
Ah, yes, we're using -z now by default.
Created attachment 15036 [details] A patch Try this.
Created attachment 15037 [details] ld.log.xz (with patch) Huh. Surprisingly, no? spawn [open ...] Running: tmpdir/pr23169b > tmpdir/pr23169b.out tmpdir/pr23169b: IFUNC symbol 'func' referenced in 'tmpdir/libpr23169a.so' is defined in the executable and creates an unsatisfiable circular dependency. FAIL: Run pr23169b x86_64-pc-linux-gnu-gcc -B/var/tmp/portage/sys-devel/binutils-2.41/work/build/ld/tmpdir/ld/ -I/var/tmp/portage/sys-devel/binutils-2.41/work/binutils-2.41/ld/testsuite/ld-ifunc -g -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -c -fno-lto -fPIE -O2 -g -c /var/tmp/portage/sys-devel/binutils-2.41/work/binutils-2.41/ld/testsuite/ld-ifunc/pr23169b.c -o tmpdir/pr23169b.o Executing on host: sh -c {x86_64-pc-linux-gnu-gcc -B/var/tmp/portage/sys-devel/binutils-2.41/work/build/ld/tmpdir/ld/ -I/var/tmp/portage/sys-devel/binutils-2.41/work/binutils-2.41/ld/testsuite/ld-ifunc -g -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -c -fno-lto -fPIE -O2 -g -c /var/tmp/portage/sys-devel/binutils-2.41/work/binutils-2.41/ld/testsuite/ld-ifunc/pr23169b.c -o tmpdir/pr23169b.o 2>&1} /dev/null ld.tmp (timeout = 300) Attached the full ld.log.
Created attachment 15039 [details] A patch Try this one.
(In reply to H.J. Lu from comment #5) > Created attachment 15039 [details] > A patch > > Try this one. That works, thank you! I've also filed PR30722 for the remaining test failures I hit.
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=51dd9e7c4cab13748f31f6575aed0672f03d6710 commit 51dd9e7c4cab13748f31f6575aed0672f03d6710 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Aug 7 10:23:16 2023 -0700 ld: Build libpr23169a.so with -z lazy pr23169b test only works with lazy binding. To work with linker which disables lazy binding by default, build pr23169b binaries with -z lazy. PR ld/30698 * ld-ifunc/ifunc.exp: Build pr23169b binaries with -z lazy.
Thank you!
The binutils-2_41-branch branch has been updated by Sam James <sjames@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=34d8c9d5b4e4fc62bea212b6bd046f26a177df4c commit 34d8c9d5b4e4fc62bea212b6bd046f26a177df4c Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Aug 7 10:23:16 2023 -0700 ld: Build libpr23169a.so with -z lazy pr23169b test only works with lazy binding. To work with linker which disables lazy binding by default, build pr23169b binaries with -z lazy. PR ld/30698 * ld-ifunc/ifunc.exp: Build pr23169b binaries with -z lazy. (cherry picked from commit 51dd9e7c4cab13748f31f6575aed0672f03d6710)