aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2022-01-05 15:22:10 +0200
committerClaudiu Zissulescu <claziss@synopsys.com>2022-01-14 12:24:52 +0200
commit68a650ba57a446fef31722cc2d5ac0752dc1b531 (patch)
tree3ead14d9a44f620e662dd74d1d01f8d9d24a5053 /gcc
parentb3989a7b1069ef9ed56911d96e1ad153e506aabb (diff)
downloadgcc-68a650ba57a446fef31722cc2d5ac0752dc1b531.zip
gcc-68a650ba57a446fef31722cc2d5ac0752dc1b531.tar.gz
gcc-68a650ba57a446fef31722cc2d5ac0752dc1b531.tar.bz2
arc: Add DWARF2 alternate CFA column.
Add DWARF 2 CFA column which tracks the return address from a signal handler context. This value must not correspond to a hard register and must be out of the range of DWARF_FRAME_REGNUM(). gcc/ * config/arc/arc.h (DWARF_FRAME_REGNUM): Update definition. (DWARF_FRAME_RETURN_COLUMN): Use RETURN_ADDR_REGNUM macro. (INCOMING_RETURN_ADDR_RTX): Likewise. (DWARF_ALT_FRAME_RETURN_COLUMN): Define. gcc/testsuite/ * gcc.target/arc/cancel-1.c: New file. libgcc/ * config/arc/linux-unwind.h (arc_fallback_frame_state): Use DWARF_ALT_FRAME_RETURN_COLUMN macro. Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/arc/arc.h11
-rw-r--r--gcc/testsuite/gcc.target/arc/cancel-1.c31
2 files changed, 39 insertions, 3 deletions
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 78b5000..539a166 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1356,7 +1356,7 @@ do { \
: (REGNO))
/* Use gcc hard register numbering for eh_frame. */
-#define DWARF_FRAME_REGNUM(REG) (REG)
+#define DWARF_FRAME_REGNUM(REG) ((REG) < 144 ? REG : INVALID_REGNUM)
/* Map register numbers held in the call frame info that gcc has
collected using DWARF_FRAME_REGNUM to those that should be output
@@ -1370,9 +1370,14 @@ do { \
: 57 + !!TARGET_MULMAC_32BY16_SET) /* MLO */ \
: (REGNO))
-#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (31)
+/* The DWARF 2 CFA column which tracks the return address. */
+#define DWARF_FRAME_RETURN_COLUMN RETURN_ADDR_REGNUM
+#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
-#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 31)
+/* The DWARF 2 CFA column which tracks the return address from a signal handler
+ context. This value must not correspond to a hard register and must be out
+ of the range of DWARF_FRAME_REGNUM(). */
+#define DWARF_ALT_FRAME_RETURN_COLUMN 144
/* Frame info. */
diff --git a/gcc/testsuite/gcc.target/arc/cancel-1.c b/gcc/testsuite/gcc.target/arc/cancel-1.c
new file mode 100644
index 0000000..e050c53
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/cancel-1.c
@@ -0,0 +1,31 @@
+/* Test for cleanups with pthread_cancel. Any issue with libgcc's unwinder
+ will cause this test to spin in pthread_join. */
+
+/* { dg-do run } */
+/* { dg-require-effective-target pthread } */
+/* { dg-options "-pthread" } */
+
+#include <pthread.h>
+#include <unistd.h>
+#include <stdio.h>
+
+void *thread_loop (void *)
+{
+ while (1)
+ {
+ printf("worker: loop\n");
+ sleep(1);
+ }
+}
+
+int main ()
+{
+ pthread_t thread;
+
+ pthread_create (&thread, 0, thread_loop, 0);
+ sleep(5);
+ pthread_cancel (thread);
+ pthread_join (thread, 0);
+
+ return 0;
+}