Skip to content

Commit 70dbbc2

Browse files
IcenowyMichael Tokarev
authored andcommitted
common-user/host/riscv: use tail pseudoinstruction for calling tail
The j pseudoinstruction maps to a JAL instruction, which can only handle a jump to somewhere with a signed 20-bit destination. In case of static linking and LTO'ing this easily leads to "relocation truncated to fit" error. Switch to use tail pseudoinstruction, which is the standard way to tail-call a function in medium code model (emits AUIPC+JALR). Signed-off-by: Icenowy Zheng <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> Cc: [email protected] (cherry picked from commit 22b448c) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 156321d commit 70dbbc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

common-user/host/riscv/safe-syscall.inc.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ safe_syscall_end:
6969

7070
/* code path setting errno */
7171
0: neg a0, a0
72-
j safe_syscall_set_errno_tail
72+
tail safe_syscall_set_errno_tail
7373

7474
/* code path when we didn't execute the syscall */
7575
2: li a0, QEMU_ERESTARTSYS
76-
j safe_syscall_set_errno_tail
76+
tail safe_syscall_set_errno_tail
7777

7878
.cfi_endproc
7979
.size safe_syscall_base, .-safe_syscall_base

0 commit comments

Comments
 (0)