Message ID | 0E1D60C2-58AE-48A6-B501-2BE801383525@sandoe-acoustics.co.uk |
---|---|
State | New |
Headers | show |
> 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. Here is Tristan's review on the above patch: -- According to the PR, this is ok. (Maybe we should restrict the swap to the known broken libc ?) Tristan.
On 18 Oct 2011, at 13:22, Arnaud Charlet wrote: >> 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. > > Here is Tristan's review on the above patch: > > -- > According to the PR, this is ok. > (Maybe we should restrict the swap to the known broken libc ?) 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. Iain
> 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. Arno
On Oct 18, 2011, at 4:58 AM, Iain Sandoe wrote: > 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. Yeah, well, it is a bug, if they ever fix it. If they burn it in and define it as correct, then, it is an unfortunatism. If they fix it, it should be software updated to older system and all tools fixed to use the new scheme. I suspect they'll never fix it. > This has been filed as radar #10302855, but we need a work-around until that is resolved (possibly forever on older systems). > +#if defined (__x86_64__) If this is for a target machine compile, this is fine. Looking through the code, it seems like target machine code, though, I wasn't sure. If it is for host code, then this isn't cross compile safe. For host code DARWIN_X86 and TARGET_64BIT (from tm.h) both need to be true, for one to be compiling for a 64-bit x86 machine. I think this is fine for relevant release branches.
> 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?) Did you apply it to the 4.6 branch? I think that this would be appropriate. > ada: > > PR target/50678 > * init.c (Darwin/__gnat_error_handler): Transpose rbx and rdx in the > handler. Sorry, I overlooked something here: there is a specific procedure to make this kind of adjustments. The reason is that the adjustment needs to be made in the tasking case as well and __gnat_error_handler isn't used for this case. So HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE must be defined in the Darwin-specific section and __gnat_adjust_context_for_raise implemented (with the standard prototype) and __gnat_error_handler changed to call it instead. Would you mind adjusting the fix that way? Thanks in advance.
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;