Eric Botcazou wrote:
>>     Hello all, and ADA hackers in particular :-)
> 
> Ada, not ADA, that's not an acronym but a name, see http://www.adaic.org

  <g> Yes, of course, I knew that really.  My most humble apologies to the
late Ms. Lovelace :-)

>>   The first problem I ran into was total failure to throw and catch
>> exceptions in ADA, failing with a SEGV every time.  It wasn't enough to
>> just set EH_MECHANISM=-gcc in the target-specific section of
>> gcc/ada/Makefile.in; I found that lots of the ada runtime had been compiled
>> without EH frame data, so the unwinder couldn't throw through them and just
>> blew up at runtime.
> 
> Yes, an annoying merge glitch.  The safest approach is probably to revert the 
> EH_MECHANISM change, on the 4.3 branch at least.  This change is pre-approved 
> if you get a working Ada compiler with it.

  Ah, thanks, I'll have to research this change, I don't know about it yet.
I'm not sure if I'll find time to investigate reverting it on the branch: my
priorities are focussed around maintaining the Cygwin distro compiler and
improving the Cygwin backend on trunk, so I'd prefer to make it work on 4.3
rather than revert it, involving local patches that won't be suitable for the
branch but will be suitable for contributing to trunk for 4.5.  (I've actually
got it working beautifully now, tests still running but an order of magnitude
better than anything I've seen before on Cygwin.  There's a bunch of other
stuff I patched to get it going that I didn't mention in this thread, in
initialize.c and sysdep.c).

>>   So I added "T_ADA_CFLAGS=-fexceptions" to the target clause in
>> Makefile.in as well, but that seems wrong to me: surely the build system
>> ought to do that already?
> 
> Neither, this is done automatically by the compiler, like in C++.

  It may in fact be that this change made no difference and the other things I
did later are what resolved my problems.

> Yes, ZCX_By_Default would have needed to be set to true in conjunction with 
> the EH_MECHANISM change, the settings are coupled.

  Great, thanks, that's good to have confirmed.  Incidentally, if I understand
rightly what's going on here, have you guys managed to make a compiler that's
runtime-switchable between SjLj and DW2 EH?  That would be suuuuch a nice
feature to have in the core GCC!  I was expecting to have to distribute two
entire sets of compilers (along with two sets of libgcc, etc.) configured
differently; do you know if the approach taken by GNAT would be capable of
porting to the main compiler?

>>   I think it might be that this arises because the GNAT I'm using to
>> bootstrap was configured for sjlj EH, and I'm trying to build one
>> configured for ZCX.
> 
> Yes, very likely.
> 
>> 1.  Is it supposed to work to bootstrap gnat with a compiler using a
>> different EH model from the one you're trying to build?
> 
> Yes, I think so.
> 
>> 2.  Where it uses the host compiler, would it be ok to use the newly-built
>> target one instead if host==target, i.e. not a cross compiler?
> 
> Yes, probably.
> 
>> 3.  Should I have needed to add -fexceptions, and if not, why not?
> 
> No, see above.

  Right.  So I suspect that the critical bits were setting EH_MECHANISM,
changing ZCX_By_Default, and the ADA_CFLAGS -> ALL_ADA_CFLAGS patching, and
that adding the -fexceptions flag was superfluous - but harmless, no?  I'd
prefer not to respin this whole release YA time if I don't have to!

  Thanks for your advice Eric, you've been a great help :)

    cheers,
      DaveK

Reply via email to