diff mbox

[Darwin/Ada] work around PR target/50678

Message ID B8F02C7C-C6AE-4FBF-B30A-4C78D7AED6BA@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Oct. 28, 2011, 11:59 a.m. UTC
On 18 Oct 2011, at 13:31, Arnaud Charlet wrote:

>> It's broken in all Libc versions that are in the wild (AFAICT from  
>> looking
>> at the released sources).
>>
>> We will need to deal with
>> configury/__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ stuff once
>> there is a fixed Libc.
>
> OK, would be good to follow up with such patch when/if this is fixed.

We are waiting for input re. the actual bug (in system code).

In the meantime,  I've applied the patch as a (hopefully temporary)  
workaround.

cheers
Iain
diff mbox

Patch

Index: gcc/ada/ChangeLog
===================================================================
--- gcc/ada/ChangeLog	(revision 180612)
+++ gcc/ada/ChangeLog	(working copy)
@@ -1,3 +1,11 @@ 
+2011-10-28  Iain Sandoe  <iains@gcc.gnu.org>
+	    Eric Botcazou  <ebotcazou@adacore.com>
+
+	PR target/50678
+	* init.c (Darwin/__gnat_error_handler): Apply a work-around to the
+	bug [filed as radar #10302855], which is inconsistent unwind data
+	for sigtramp.
+
 2011-10-28  Eric Botcazou  <ebotcazou@adacore.com>
 
 	PR ada/50842
Index: gcc/ada/init.c
===================================================================
--- gcc/ada/init.c	(revision 180612)
+++ 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)
     {