This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix for PR libstdc++/60758


On 04.04.2014 14:44, Alexey Merzlyakov wrote:
Hi all,

Here is a patch, that fixes infinite backtraces in __cxa_end_cleanup().
The Bugzilla entry for this:http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60758

The __cxa_end_cleanup() does not save/restore LR in function header/footer and does not provide any unwind info, which causes problems with GDB and other tools (e.g. unwind code in libgcc, libbacktrace, etc.).

Best regards,
Merzlyakov Alexey

2014-04-03  Alexey Merzlyakov <alexey.merzlyakov@samsung.com>

    PR libstdc++/60758
    * libsupc++/eh_arm.cc (__cxa_end_cleanup): Add LR save/restore.

diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc
index aa453dd..ead1e61 100644
--- a/libstdc++-v3/libsupc++/eh_arm.cc
+++ b/libstdc++-v3/libsupc++/eh_arm.cc
@@ -206,9 +206,9 @@ asm ("  .pushsection .text.__cxa_end_cleanup\n"
 "    .type __cxa_end_cleanup, \"function\"\n"
 "    .thumb_func\n"
 "__cxa_end_cleanup:\n"
-"    push\t{r1, r2, r3, r4}\n"
+"    push\t{r1, r2, r3, r4, lr}\n"
 "    bl\t__gnu_end_cleanup\n"
-"    pop\t{r1, r2, r3, r4}\n"
+"    pop\t{r1, r2, r3, r4, lr}\n"
 "    bl\t_Unwind_Resume @ Never returns\n"
 "    .popsection\n");
 #else
@@ -216,9 +216,9 @@ asm ("  .pushsection .text.__cxa_end_cleanup\n"
 "    .global __cxa_end_cleanup\n"
 "    .type __cxa_end_cleanup, \"function\"\n"
 "__cxa_end_cleanup:\n"
-"    stmfd\tsp!, {r1, r2, r3, r4}\n"
+"    stmfd\tsp!, {r1, r2, r3, r4, lr}\n"
 "    bl\t__gnu_end_cleanup\n"
-"    ldmfd\tsp!, {r1, r2, r3, r4}\n"
+"    ldmfd\tsp!, {r1, r2, r3, r4, lr}\n"
 "    bl\t_Unwind_Resume @ Never returns\n"
 "    .popsection\n");
 #endif


Forgot to mention:
the patch has been tested on ARM - no regressions.

Best regards,
Merzlyakov Alexey


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]