I'm not sure exactly why, but it looks like this has started failing on
the latest Fedora rebuilds (with a bump to GCC-14 prereleases) with
errors along the lines of
/usr/bin/ld: .libs/libhello_la-hello.o: relocation R_RISCV_HI20 against `a
local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: .libs/libhello_la-foo.o: relocation R_RISCV_HI20 against `a
local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: unresolvable R_RISCV_CALL_PLT relocation against symbol
`puts@@GLIBC_2.27'
/usr/bin/ld: unresolvable R_RISCV_CALL_PLT relocation against symbol
`__printf_chk@@GLIBC_2.27'
As far as I can tell this always should have failed on RISC-V, as
non-PIC objects have never worked correctly in shared libraries. We
have added some stricter linker error checking over the last few months
so it's possible this is a newly reported error, but I'd guess that the
resulting binaries have always been invalid.
Regardless of exactly why it's getting noticed now, R_RISCV_HI20 is very
much an absolute relocation (it maps to LUI, which just loads up a
constant address) and thus won't work for shared libraries. Given that
other ports skip this test that seems like the way to go for RISC-V
as well.
Signed-off-by: Palmer Dabbelt <[email protected]>
---
tests/demo.at | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/demo.at b/tests/demo.at
index feb71dcd..b62a9215 100644
--- a/tests/demo.at
+++ b/tests/demo.at
@@ -511,7 +511,7 @@ AT_CLEANUP
AT_SETUP([force non-PIC objects])
AT_CHECK([case $host in
-hppa*|amd64*|x86_64*|s390*)
+hppa*|amd64*|x86_64*|s390*|riscv*)
# These hosts cannot use non-PIC shared libs
exit 77 ;;
*-solaris*|*-sunos*)
--
2.43.0