summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/arc/Makefile.arch3
-rw-r--r--libc/sysdeps/linux/arc/sigaction.c6
-rw-r--r--libc/sysdeps/linux/arc/sigrestorer.S25
3 files changed, 28 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/arc/Makefile.arch b/libc/sysdeps/linux/arc/Makefile.arch
index 1a52fc9bf..a4aa72c0a 100644
--- a/libc/sysdeps/linux/arc/Makefile.arch
+++ b/libc/sysdeps/linux/arc/Makefile.arch
@@ -7,4 +7,5 @@
CSRC-y := syscall.c sigaction.c __syscall_error.c cacheflush.c
-SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S vfork.S clone.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S vfork.S clone.S \
+ sigrestorer.S
diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c
index 67ca38aca..64a6255c4 100644
--- a/libc/sysdeps/linux/arc/sigaction.c
+++ b/libc/sysdeps/linux/arc/sigaction.c
@@ -13,11 +13,7 @@
/*
* Default sigretrun stub if user doesn't specify SA_RESTORER
*/
-static void attribute_optimize("Os") __attribute_noinline__
-__default_rt_sa_restorer(void)
-{
- INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
-}
+extern void __default_rt_sa_restorer(void);
#define SA_RESTORER 0x04000000
diff --git a/libc/sysdeps/linux/arc/sigrestorer.S b/libc/sysdeps/linux/arc/sigrestorer.S
new file mode 100644
index 000000000..e4deb6bd4
--- /dev/null
+++ b/libc/sysdeps/linux/arc/sigrestorer.S
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 Synopsys, Inc. (www.synopsys.com)
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sysdep.h>
+
+/*
+ * Default sigretrun stub if user doesn't specify SA_RESTORER.
+ */
+
+.section .text
+.align 4
+.global __default_rt_sa_restorer
+.type __default_rt_sa_restorer, @function
+
+; This "nop" is needed here, because debugger would assume that this function
+; called the signal handler, therefore it cannot start on the "mov"
+; instruction, at which execution will jump to.
+ nop
+__default_rt_sa_restorer:
+ mov r8, __NR_rt_sigreturn
+ ARC_TRAP_INSN
+