1 From 15c7c4d39b317f0d902ef28fd43eca5c3369f891 Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Sat, 15 Aug 2015 05:12:11 +0300
4 Subject: [PATCH 3/3] xtensa: fix _Unwind_GetCFA
6 Returning context->cfa in _Unwind_GetCFA makes CFA point one stack frame
7 higher than what was actually used by code at context->ra. This results
8 in invalid CFA value in signal frames and premature unwinding completion
9 in forced unwinding used by uClibc NPTL thread cancellation.
10 Returning context->sp from _Unwind_GetCFA makes all CFA values valid and
11 matching code that used them.
13 2015-08-18 Max Filippov <jcmvbkbc@gmail.com>
15 * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return
16 context->sp instead of context->cfa.
18 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
20 Backported from: r226964
22 libgcc/config/xtensa/unwind-dw2-xtensa.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
25 diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c
26 index 35f7797..ef6b900 100644
27 --- a/libgcc/config/xtensa/unwind-dw2-xtensa.c
28 +++ b/libgcc/config/xtensa/unwind-dw2-xtensa.c
29 @@ -130,7 +130,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index)
31 _Unwind_GetCFA (struct _Unwind_Context *context)
33 - return (_Unwind_Ptr) context->cfa;
34 + return (_Unwind_Ptr) context->sp;
37 /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */