about summary refs log tree commit diff
path: root/sysdeps/riscv
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2021-10-28 11:39:49 -0700
committerFangrui Song <maskray@google.com>2021-10-28 11:39:49 -0700
commit68389203832ab39dd0dbaabbc4059e7fff51c29b (patch)
treef3c62c53064fd060566f1ed33688dc9c75323fe4 /sysdeps/riscv
parent9b7cfab1802b71763da00982f772208544cf4a95 (diff)
downloadglibc-68389203832ab39dd0dbaabbc4059e7fff51c29b.tar.gz
glibc-68389203832ab39dd0dbaabbc4059e7fff51c29b.tar.xz
glibc-68389203832ab39dd0dbaabbc4059e7fff51c29b.zip
riscv: Fix incorrect jal with HIDDEN_JUMPTARGET
A non-local STV_DEFAULT defined symbol is by default preemptible in a
shared object. j/jal cannot target a preemptible symbol. On other
architectures, such a jump instruction either causes PLT [BZ #18822], or
if short-ranged, sometimes rejected by the linker (but not by GNU ld's
riscv port [ld PR/28509]).

Use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead.

With this patch, ld.so and libc.so can be linked with LLD if source
files are compiled/assembled with -mno-relax/-Wa,-mno-relax.

Acked-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/riscv')
-rw-r--r--sysdeps/riscv/setjmp.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/riscv/setjmp.S b/sysdeps/riscv/setjmp.S
index 0b92016b31..bec7ff80f4 100644
--- a/sysdeps/riscv/setjmp.S
+++ b/sysdeps/riscv/setjmp.S
@@ -21,7 +21,7 @@
 
 ENTRY (_setjmp)
   li	a1, 0
-  j	__sigsetjmp
+  j	HIDDEN_JUMPTARGET (__sigsetjmp)
 END (_setjmp)
 ENTRY (setjmp)
   li	a1, 1