873-xtensa-fix-_Unwind_GetCFA.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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
  5. Returning context->cfa in _Unwind_GetCFA makes CFA point one stack frame
  6. higher than what was actually used by code at context->ra. This results
  7. in invalid CFA value in signal frames and premature unwinding completion
  8. in forced unwinding used by uClibc NPTL thread cancellation.
  9. Returning context->sp from _Unwind_GetCFA makes all CFA values valid and
  10. matching code that used them.
  11. 2015-08-18 Max Filippov <jcmvbkbc@gmail.com>
  12. libgcc/
  13. * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return
  14. context->sp instead of context->cfa.
  15. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  16. ---
  17. Backported from: r226964
  18. libgcc/config/xtensa/unwind-dw2-xtensa.c | 2 +-
  19. 1 file changed, 1 insertion(+), 1 deletion(-)
  20. diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c
  21. index 35f7797..ef6b900 100644
  22. --- a/libgcc/config/xtensa/unwind-dw2-xtensa.c
  23. +++ b/libgcc/config/xtensa/unwind-dw2-xtensa.c
  24. @@ -130,7 +130,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index)
  25. _Unwind_Word
  26. _Unwind_GetCFA (struct _Unwind_Context *context)
  27. {
  28. - return (_Unwind_Ptr) context->cfa;
  29. + return (_Unwind_Ptr) context->sp;
  30. }
  31. /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */
  32. --
  33. 1.8.1.4