]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] csky: define DWARF_ALT_FRAME_RETURN_COLUMN`
authorRamin Moussavi <lordrasmus@gmail.com>
Sat, 6 Jun 2026 05:13:12 +0000 (23:13 -0600)
committerJeff Law <jeffrey.law@oss.qualcomm.com>
Sat, 6 Jun 2026 05:13:12 +0000 (23:13 -0600)
Tested with a csky-linux-uclibc gcc 15.2.0 cross compiler against uClibc-ng,
running its NPTL test suite on qemu-system-cskyv2: without the fix eight
cancellation tests abort (tst-cancel1/10/11/13/15/16/18, tst-cleanup4); with
it all pass and the rest of the suite is unchanged.

gcc/ChangeLog:

* config/csky/csky.h (DWARF_ALT_FRAME_RETURN_COLUMN): Define.

Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
gcc/config/csky/csky.h

index 3a570051e4f021f876b64e7032e3c9cc7098ffa3..b7dadc92dd7049288e17aae8984130c765366e27 100644 (file)
@@ -1007,6 +1007,14 @@ while (0)
    define DWARF_FRAME_RETURN_COLUMN to DWARF_FRAME_REGNUM.  */
 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (CSKY_LR_REGNUM)
 
+/* The Linux signal-frame fallback (config/csky/linux-unwind.h) records the
+   interrupted PC in DWARF column 32, one past the hard registers, and uses
+   it as the return column.  Declare it as the alternate return column so
+   that init_dwarf_reg_size_table sizes it; otherwise _Unwind_GetGR reads a
+   zero size and aborts when unwinding through a signal frame, such as
+   during NPTL pthread cancellation.  */
+#define DWARF_ALT_FRAME_RETURN_COLUMN 32
+
 /* Use r0 and r1 to pass exception handling information.  */
 #define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? N : INVALID_REGNUM)