Bug 31773 - [RISC-V] Build regression: "read-only segment has dynamic relocations"
Summary: [RISC-V] Build regression: "read-only segment has dynamic relocations"
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-21 11:12 UTC by Maciej W. Rozycki
Modified: 2024-05-21 19:41 UTC (History)
3 users (show)

See Also:
Host:
Target: riscv64-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej W. Rozycki 2024-05-21 11:12:32 UTC
As from commit e0590f41fe1e ("RISC-V: Enable static-pie.") the library
fails to build:

riscv64-linux-gnu-gcc  -o .../support/test-run-command -nostdlib -nostartfiles -static -static-pie     .../csu/rcrt1.o .../csu/crti.o `riscv64-linux-gnu-gcc   --print-file-name=crtbeginS.o` .../support/test-run-command.o .../elf/static-stubs.o .../support/libsupport_nonshared.a  -Wl,--start-group .../libc.a -lgcc  -Wl,--end-group `riscv64-linux-gnu-gcc   --print-file-name=crtendS.o` .../csu/crtn.o.../bin/../lib/gcc/riscv64-linux-gnu/14.0.0/../../../../riscv64-linux-gnu/bin/ld: read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status
make[2]: *** [../Rules:290: .../support/test-run-command] Error 1

I can see there is an autoconf test included with the commit referred
that is supposed to catch toolchain configurations that are unsuitable
for PIE, however evidently the logic fails to trigger here, so a better
one may be needed.

Versions of tools used to reproduce:

GCC:
riscv64-linux-gnu-gcc (GCC) 14.0.0 20240110 (experimental)
commit 3353e7d28447 ("RISC-V/testsuite: Fix comment termination in
pr105314.c")

binutils:
GNU ld (GNU Binutils) 2.40.50.20230510
commit 8b7b3b2bf435 ("or1k relocation truncated to fit: R_OR1K_GOT16
even when using -mcmodel=large")
Comment 1 Adhemerval Zanella 2024-05-21 19:41:50 UTC
It seems that binutils before 225df051d3d4cf714d1791b9035966a6686b3f3d fails to build static-pie correctly, so maybe add a similar test on glibc configure test.