]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/50678 (FAIL: c52104y on x86_64-apple-darwin10)
authorIain Sandoe <iains@gcc.gnu.org>
Mon, 21 Nov 2011 09:04:08 +0000 (09:04 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Mon, 21 Nov 2011 09:04:08 +0000 (09:04 +0000)
gcc/ada:

Backport from mainline r181474
PR target/50678
* init.c (__gnat_error_handler) [Darwin]: Move work-around to the
bug filed as radar #10302855 from __gnat_error_handler ...
... to (__gnat_adjust_context_for_raise) [Darwin]: New.
(HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE) [Darwin]: Define.
(__gnat_error_handler) [Darwin]: Use __gnat_adjust_context_for_raise.

From-SVN: r181553

gcc/ada/ChangeLog
gcc/ada/init.c

index 7ae36459dfd5fea365d1b251ed088c4dff846d4d..ef96695b7c8b782a0610ad2923fc6df31ac7314c 100644 (file)
@@ -1,3 +1,13 @@
+2011-11-13  Iain Sandoe  <iains@gcc.gnu.org>
+
+       Backport from mainline r181474
+       PR target/50678
+       * init.c (__gnat_error_handler) [Darwin]: Move work-around to the
+       bug filed as radar #10302855 from __gnat_error_handler ...
+       ... to (__gnat_adjust_context_for_raise) [Darwin]: New.
+       (HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE) [Darwin]: Define.
+       (__gnat_error_handler) [Darwin]: Use __gnat_adjust_context_for_raise.
+       
 2011-11-18  Tristan Gingold  <gingold@adacore.com>
            Iain Sandoe  <iains@gcc.gnu.org>
 
index 9b6370e1a5779b4153634aaaa91ebe33c2464e78..f6c1a5b4ed20e21917c8c66551b8ea985a01a4cc 100644 (file)
@@ -2216,12 +2216,33 @@ __gnat_is_stack_guard (mach_vm_address_t addr)
   return 0;
 }
 
+#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
+
+void
+__gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED,
+                                void *ucontext ATTRIBUTE_UNUSED)
+{
+#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
+}
+
 static void
-__gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED)
+__gnat_error_handler (int sig, siginfo_t *si, void *ucontext)
 {
   struct Exception_Data *exception;
   const char *msg;
 
+  __gnat_adjust_context_for_raise (sig, ucontext);
+
   switch (sig)
     {
     case SIGSEGV: