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>
This commit is contained in:
parent
b3989a7b10
commit
68a650ba57
|
@ -1356,7 +1356,7 @@ do { \
|
||||||
: (REGNO))
|
: (REGNO))
|
||||||
|
|
||||||
/* Use gcc hard register numbering for eh_frame. */
|
/* 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
|
/* Map register numbers held in the call frame info that gcc has
|
||||||
collected using DWARF_FRAME_REGNUM to those that should be output
|
collected using DWARF_FRAME_REGNUM to those that should be output
|
||||||
|
@ -1370,9 +1370,14 @@ do { \
|
||||||
: 57 + !!TARGET_MULMAC_32BY16_SET) /* MLO */ \
|
: 57 + !!TARGET_MULMAC_32BY16_SET) /* MLO */ \
|
||||||
: (REGNO))
|
: (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. */
|
/* Frame info. */
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -120,10 +120,11 @@ arc_fallback_frame_state (struct _Unwind_Context *context,
|
||||||
= ((_Unwind_Ptr) &(regs[i])) - new_cfa;
|
= ((_Unwind_Ptr) &(regs[i])) - new_cfa;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs->regs.reg[31].how = REG_SAVED_VAL_OFFSET;
|
fs->signal_frame = 1;
|
||||||
fs->regs.reg[31].loc.offset = ((_Unwind_Ptr) (regs[ret])) - new_cfa;
|
fs->retaddr_column = __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__;
|
||||||
|
fs->regs.reg[fs->retaddr_column].how = REG_SAVED_VAL_OFFSET;
|
||||||
fs->retaddr_column = 31;
|
fs->regs.reg[fs->retaddr_column].loc.offset =
|
||||||
|
((_Unwind_Ptr) (regs[ret])) - new_cfa;
|
||||||
|
|
||||||
return _URC_NO_REASON;
|
return _URC_NO_REASON;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue