summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/csky/setjmp.S
diff options
context:
space:
mode:
authorGuo Ren <ren_guo@c-sky.com>2018-03-15 10:40:27 +0800
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-03-15 20:39:56 +0100
commit8be3a69f1881cb87189164821c631fb398ea2b11 (patch)
treee52473e16d406e32cd33a6702cab75963dd51fac /libc/sysdeps/linux/csky/setjmp.S
parentbf4c2d242f587700e3eb2ffd5721ddaf3cdbc7e5 (diff)
csky: support bsd-setjmp and bsd-_setjmp.
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Diffstat (limited to 'libc/sysdeps/linux/csky/setjmp.S')
-rw-r--r--libc/sysdeps/linux/csky/setjmp.S18
1 files changed, 15 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/csky/setjmp.S b/libc/sysdeps/linux/csky/setjmp.S
index 03b402b2d..fb4b156c4 100644
--- a/libc/sysdeps/linux/csky/setjmp.S
+++ b/libc/sysdeps/linux/csky/setjmp.S
@@ -7,7 +7,7 @@
#include <sysdep.h>
-ENTRY(setjmp)
+ENTRY(__sigsetjmp)
stw sp, (a0, 0)
stw lr, (a0, 4)
@@ -43,8 +43,20 @@ ENTRY(setjmp)
ldw lr, (sp, 0)
addi sp, 8
rts
+END(__sigsetjmp)
+
+/*
+ * Support bsd-setjmp and bsd-_setjmp with tail-call method.
+ * Use br to keep the lr-reg, we must return to the Caller not setjmp.
+ * And we will rts by __sigsetjmp.
+ */
+ENTRY(setjmp)
+ movi a1, 1
+ br __sigsetjmp
END(setjmp)
-strong_alias(setjmp, __sigsetjmp)
-strong_alias(setjmp, _setjmp)
+ENTRY(_setjmp)
+ movi a1, 0
+ br __sigsetjmp
+END(_setjmp)