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]

[Patch Darwin/Ada] work around PR target/50678


The audit trail in the PR contains the detective work (mostly by Eric) that concludes we have a long-standing bug in the Darwin x86-64 sigtramp unwind data.
This has been filed as radar #10302855, but we need a work-around until that is resolved (possibly forever on older systems).


OK for trunk?
(what opinion about 4.6?)

ada:

	PR target/50678
	* init.c (Darwin/__gnat_error_handler): Transpose rbx and rdx in the
	handler.

Index: gcc/ada/init.c
===================================================================
--- gcc/ada/init.c (revision 180097)
+++ gcc/ada/init.c (working copy)
@@ -2287,6 +2287,16 @@ __gnat_error_handler (int sig, siginfo_t *si, void
{
struct Exception_Data *exception;
const char *msg;
+#if defined (__x86_64__)
+ /* Work around radar #10302855/pr50678, where the unwinders (libunwind or
+ libgcc_s depending on the system revision) and the DWARF unwind data for
+ the sigtramp have different ideas about register numbering (causing rbx
+ and rdx to be transposed). */
+ ucontext_t *uc = (ucontext_t *)ucontext ;
+ unsigned long t = uc->uc_mcontext->__ss.__rbx;
+ uc->uc_mcontext->__ss.__rbx = uc->uc_mcontext->__ss.__rdx;
+ uc->uc_mcontext->__ss.__rdx =t;
+#endif


   switch (sig)
     {


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