]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
RISC-V: Allow long jumps to __syscall_error
authorŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 16 Sep 2022 19:31:27 +0000 (21:31 +0200)
committerDJ Delorie <dj@redhat.com>
Sat, 17 Sep 2022 03:25:45 +0000 (23:25 -0400)
__syscall_error may end up farther than 1MiB away from a caller,
especially when linking statically large binaries. tail allows for
4GiB jumps and is reduced to j when a linked symbol is within range.

Fixes: 36960f0c76 ("RISC-V: Linux Syscall Interface")
Fixes: 7f33b09c65 ("RISC-V: Linux ABI")
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
sysdeps/unix/sysv/linux/riscv/clone.S
sysdeps/unix/sysv/linux/riscv/getcontext.S
sysdeps/unix/sysv/linux/riscv/setcontext.S
sysdeps/unix/sysv/linux/riscv/swapcontext.S
sysdeps/unix/sysv/linux/riscv/sysdep.h
sysdeps/unix/sysv/linux/riscv/vfork.S

index d7d2915e87b256844cac359eec08b54c15afe6f7..45ea8f184b2d289d91d545c97da87c8e8d8db9b8 100644 (file)
@@ -63,7 +63,7 @@ L (invalid):
        li              a0, -EINVAL
        /* Something bad happened -- no child created.  */
 L (error):
-       j               __syscall_error
+       tail            __syscall_error
        END (__clone)
 
 /* Load up the arguments to the function.  Put this block of code in
index 499f70b65d054ea573d77536ee4f4662b24dc073..f4f828805cbffa6f4c1f5002c40a37b0a9965e71 100644 (file)
@@ -70,7 +70,7 @@ LEAF (__getcontext)
 
        ret
 
-99:    j       __syscall_error
+99:    tail    __syscall_error
 
 PSEUDO_END (__getcontext)
 
index e3bc84a2e6ef9227663d9ddc6cb22b19d5a830ea..1e529b900c3789a42f3e57b23d982db3d769dac7 100644 (file)
@@ -92,7 +92,7 @@ LEAF (__setcontext)
 
        jr      t1
 
-99:    j       __syscall_error
+99:    tail    __syscall_error
 
 END (__setcontext)
 libc_hidden_def (__setcontext)
index 4da615f6d4bf3e1dfd3cc62470dcccc3c887e279..287ba364cd34ebce50d7b1d500ad3a64f089e4d7 100644 (file)
@@ -118,7 +118,7 @@ LEAF (__swapcontext)
        jr      t1
 
 
-99:    j       __syscall_error
+99:    tail    __syscall_error
 
 PSEUDO_END (__swapcontext)
 
index 37ff07a0d7d4b5205da334d8b5431c55ca058f05..9b03b105670b5222202d91e587b514d39e760123 100644 (file)
 # else
 #  define SYSCALL_ERROR_HANDLER(name)                          \
 .Lsyscall_error ## name:                                       \
-        j       __syscall_error;
+        tail    __syscall_error;
 # endif
 
 /* Performs a system call, not setting errno.  */
index 09705436196a415ea3218c811ffb66e6811b6c88..1482406e2dde04a45ac728d6c5713965fb96f9b5 100644 (file)
@@ -39,7 +39,7 @@ LEAF (__libc_vfork)
        bltz    a0, 1f
        ret
 
-1:     j               __syscall_error
+1:     tail    __syscall_error
 END (__libc_vfork)
 
 weak_alias (__libc_vfork, vfork)