From 15b21d23e9347af296f332787e7cf5fe96b21564 Mon Sep 17 00:00:00 2001 From: jcmvbkbc Date: Tue, 18 Aug 2015 01:08:22 +0000 Subject: [PATCH] xtensa: fix _Unwind_GetCFA Returning context->cfa in _Unwind_GetCFA makes CFA point one stack frame higher than what was actually used by code at context->ra. This results in invalid CFA value in signal frames and premature unwinding completion in forced unwinding used by uClibc NPTL thread cancellation. Returning context->sp from _Unwind_GetCFA makes all CFA values valid and matching code that used them. 2015-08-18 Max Filippov libgcc/ * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return context->sp instead of context->cfa. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226964 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 5 +++++ libgcc/config/xtensa/unwind-dw2-xtensa.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index c186881ebcbb..0d1acf302dfd 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,5 +1,10 @@ 2015-08-18 Max Filippov + * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return + context->sp instead of context->cfa. + +2015-08-18 Max Filippov + * config/xtensa/t-windowed (LIB2ADDEH): Replace unwind-dw2-fde with unwind-dw2-fde-dip. diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c index 82b0e6314b00..8e579c7617d3 100644 --- a/libgcc/config/xtensa/unwind-dw2-xtensa.c +++ b/libgcc/config/xtensa/unwind-dw2-xtensa.c @@ -130,7 +130,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index) _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *context) { - return (_Unwind_Ptr) context->cfa; + return (_Unwind_Ptr) context->sp; } /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ -- 2.11.4.GIT