diff mbox series

[02/11] riscv: Fix --enable-ubsan build failure on riscv

Message ID 20250507142110.3452012-3-adhemerval.zanella@linaro.org
State New
Headers show
Series Add initial support for --enable-ubsan | expand

Commit Message

Adhemerval Zanella May 7, 2025, 2:17 p.m. UTC
With ubsan enable, libc.so fails to build with:

[...]linkobj/libc_pic.a(setcontext.os): in function `__start_context':
[...]sysdeps/unix/sysv/linux/riscv/setcontext.S:111:(.text+0xc0): relocation
truncated to fit: R_RISCV_JAL against symbol `__GI_exit' defined in .text section
in [...]/linkobj/libc_pic.a(exit.os)

Using 'call' instead of 'j' works regardless whether UBSAN.
---
 sysdeps/unix/sysv/linux/riscv/setcontext.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
index a2de57b537..11dd46ea17 100644
--- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
+++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
@@ -110,6 +110,6 @@  LEAF (__start_context)
 	mv	a0, s2
 	beqz	s2, 1f
 	jal	HIDDEN_JUMPTARGET (__setcontext)
-1:	j	HIDDEN_JUMPTARGET (exit)
+1:	call	HIDDEN_JUMPTARGET (exit)
 
 END (__start_context)