Building glibc 2.38 with --enable-bind-now on riscv64 with the current binutils binutils-2_41-branch branch (actually through the sid debian package in version 2.41.50.20231206-1) causes the elf/tst-audit1 elf/tst-audit2 elf/tst-audit8 tests to fail with a segfault. Not using --enable-bind-now, that is not passing -z now to ld, workaround the issue. This is a regression from version 2.41, for which the tests pass with both with and without --enable-bind-now.
Created attachment 15251 [details] Reproducer I have attached a (big) reproduced for this bug. This is basically the files from the glibc build tree and the associated tests. Just use run.sh to link libc.so with and without -z now and see the difference in the testsuite result
A bisect pointed me to the following commit: 7345d05aafde53a48d5a587a6d9c1778db78e0f3 is the first bad commit commit 7345d05aafde53a48d5a587a6d9c1778db78e0f3 Author: Andreas Schwab <schwab@suse.de> Date: Thu Sep 21 16:49:41 2023 +0200 RISC-V: Protect .got with relro Move .got before .data so that it can be protected with -zrelro. Also separate .got.plt from .got if -znow is not in effect; the first two words of .got.plt are placed within the relro region. ld: PR ld/30877 * emulparams/elf32lriscv-defs.sh (DATA_GOT, SEPARATE_GOTPLT): Define. * emulparams/elf64lriscv-defs.sh (SEPARATE_GOTPLT): Define. * testsuite/ld-elf/binutils.exp (binutils_test): Remove riscv*-*-* from relro_got expression. ld/emulparams/elf32lriscv-defs.sh | 4 ++++ ld/emulparams/elf64lriscv-defs.sh | 1 + ld/testsuite/ld-elf/binutils.exp | 1 - 3 files changed, 5 insertions(+), 1 deletion(-)
Which means it is a bug in glibc.
(In reply to Andreas Schwab from comment #3) > Which means it is a bug in glibc. Ok, thanks, I have opened bug #31151. Closing the bug here.