From: Max Filippov Date: Tue, 30 May 2017 23:32:21 +0000 (+0000) Subject: xtensa: fix _Unwind_GetCFA X-Git-Tag: releases/gcc-5.5.0~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03ca272fcdf074e918cc754b76d2cdfe2c6b64d0;p=thirdparty%2Fgcc.git 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. 2017-05-30 Max Filippov libgcc/ Backport from mainline 2015-08-18 Max Filippov * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return context->sp instead of context->cfa. From-SVN: r248703 --- diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 8f8e7e34ecfa..c9b698f3799d 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,11 @@ +2017-05-30 Max Filippov + + Backport from mainline + 2015-08-18 Max Filippov + + * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return + context->sp instead of context->cfa. + 2017-05-30 Max Filippov Backport from mainline 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. */