mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
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>
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
ENTRY (_setjmp)
|
ENTRY (_setjmp)
|
||||||
li a1, 0
|
li a1, 0
|
||||||
j __sigsetjmp
|
j HIDDEN_JUMPTARGET (__sigsetjmp)
|
||||||
END (_setjmp)
|
END (_setjmp)
|
||||||
ENTRY (setjmp)
|
ENTRY (setjmp)
|
||||||
li a1, 1
|
li a1, 1
|
||||||
|
@@ -95,6 +95,7 @@ LEAF (__setcontext)
|
|||||||
99: j __syscall_error
|
99: j __syscall_error
|
||||||
|
|
||||||
END (__setcontext)
|
END (__setcontext)
|
||||||
|
libc_hidden_def (__setcontext)
|
||||||
weak_alias (__setcontext, setcontext)
|
weak_alias (__setcontext, setcontext)
|
||||||
|
|
||||||
LEAF (__start_context)
|
LEAF (__start_context)
|
||||||
@@ -108,7 +109,7 @@ LEAF (__start_context)
|
|||||||
/* Invoke subsequent context if present, else exit(0). */
|
/* Invoke subsequent context if present, else exit(0). */
|
||||||
mv a0, s2
|
mv a0, s2
|
||||||
beqz s2, 1f
|
beqz s2, 1f
|
||||||
jal __setcontext
|
jal HIDDEN_JUMPTARGET (__setcontext)
|
||||||
1: j exit
|
1: j HIDDEN_JUMPTARGET (exit)
|
||||||
|
|
||||||
END (__start_context)
|
END (__start_context)
|
||||||
|
Reference in New Issue
Block a user