]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
riscv: Fix --enable-ubsan build failure on riscv
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 30 Apr 2025 17:25:28 +0000 (14:25 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 7 May 2025 13:41:34 +0000 (10:41 -0300)
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

index a2de57b537b0db5864f40f00950efa0a535270e8..11dd46ea17e5388315888b64dbab1aa8e2cba2a6 100644 (file)
@@ -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)