Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
OK for trunk ( + 4.6 after a re-check and with a suitable variant of system-darwin-ppc64.ads )? Yes, this looks fine as far as I'm concerned, thanks. -- Eric Botcazou
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
On Sep 7, 2011, at 12:22 AM, Iain Sandoe wrote: OK for trunk ( + 4.6 after a re-check and with a suitable variant of system-darwin-ppc64.ads )? Ok.
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
1. rs6000.c (WORLD_SAVE_P) decides on the use of the out-of-line prologue saves on the basis of cfun-calls_setjmp flag_exceptions. of course, flag_exceptions is NOT set by Ada for SjLj - which is what's used for the compiler build. It isn't set because GNAT implements a different SJLJ scheme, entirely based on __builtin_setjmp/__builtin_longjmp. It is incompatible with the regular EH scheme so flag_exceptions cannot be set. - it doesn't seem reasonable to force -fexceptions - until we can build ada with ZCE. Or change the SJLJ scheme. - so, given that SjLj exceptions are in use w/out the flag - it seems that the check should be adjusted. 2. (TRUNK-only) ** Eric, you removed the setting of cfun-calls_setjmp from gcc/ builtins.c (in June). This (re)breaks trunk c.f. 4.6 - given the fix to (1). Was there some reason to remove this? Yes, the comment just above was obsolete after the SPARC change. Moreover, __builtin_setjmp is not like setjmp, it is lowered into internal constructs that represent all of its effects so using the cfun-calls_setjmp big hammer looks overkill to me. ... would there be some more appropriate test for rs6000.c to use? Possibly, what's the exact reason why the special routines cannot be used? 3. There is no multi-lib target set for powerpc64-darwin, thus bootstrap fails with a Bad Alignment error in building the target libs. Since this is a long-standing regression (last bootstrap for powerpc- darwin was likely in the 4.2 era). OK for 4.6 (1, 3) and trunk (1,2 3) ? Be careful about system-darwin-ppc64.ads: I don't think you can backport an instance from the trunk to the 4.6 branch, as there is at least one entry missing at the end. Thanks for working on this! -- Eric Botcazou
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
Hello Eric, On 6 Sep 2011, at 08:41, Eric Botcazou wrote: - it doesn't seem reasonable to force -fexceptions - until we can build ada with ZCE. Or change the SJLJ scheme. Hm. I'm probably being a bit dumb here - but not clear about which scheme/where in the code-base you have in mind. (I get the point about the SjLj scheme used by Ada being different). ... would there be some more appropriate test for rs6000.c to use? Possibly, what's the exact reason why the special routines cannot be used? That's a good question, and one that I haven't got to the bottom of - but the exclusion was there in the original code-base [still in the vendor's tree too]. (also, the rs6000 pro/epilogue code is not the easiest to navigate). 3. There is no multi-lib target set for powerpc64-darwin, thus bootstrap fails with a Bad Alignment error in building the target libs. Since this is a long-standing regression (last bootstrap for powerpc- darwin was likely in the 4.2 era). OK for 4.6 (1, 3) and trunk (1,2 3) ? Be careful about system-darwin-ppc64.ads: I don't think you can backport an instance from the trunk to the 4.6 branch, as there is at least one entry missing at the end. Yes, I have a different version for 4.6 with the recently deleted entries still intact (and, of course, it has been tested). cheers Iain
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
That's a good question, and one that I haven't got to the bottom of - but the exclusion was there in the original code-base [still in the vendor's tree too]. (also, the rs6000 pro/epilogue code is not the easiest to navigate). Assuming that this is because the non-local goto handler needs to find a register saved at a canonical place, you can try !cfun-has_nonlocal_label. This will subsume the original check !(cfun-calls_setjmp flag_exceptions) as both the regular SJLJ scheme and the GNAT SJLJ scheme use it. Yes, I have a different version for 4.6 with the recently deleted entries still intact (and, of course, it has been tested). OK. -- Eric Botcazou
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
On Sep 6, 2011, at 1:12 AM, Eric Botcazou wrote: That's a good question, and one that I haven't got to the bottom of - but the exclusion was there in the original code-base [still in the vendor's tree too]. (also, the rs6000 pro/epilogue code is not the easiest to navigate). Assuming that this is because the non-local goto handler needs to find a register saved at a canonical place, you can try !cfun-has_nonlocal_label. This will subsume the original check !(cfun-calls_setjmp flag_exceptions) as both the regular SJLJ scheme and the GNAT SJLJ scheme use it. I can't confirm the assumption, but, if it holds, sounds nicer to me, thanks.
[Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
Well, this was two needles in a haystack ... ... AFAICT from googling, powerpc-darwin9 has never bootstrapped ADA (I see questions but no resolution). Perhaps Adacore has a version ... but I was unable to find any starting point - so this was somewhat tough to debug. Anyway, there are two issues for 4.6 and three for trunk: 1. rs6000.c (WORLD_SAVE_P) decides on the use of the out-of-line prologue saves on the basis of cfun-calls_setjmp flag_exceptions. of course, flag_exceptions is NOT set by Ada for SjLj - which is what's used for the compiler build. - it doesn't seem reasonable to force -fexceptions - until we can build ada with ZCE. - so, given that SjLj exceptions are in use w/out the flag - it seems that the check should be adjusted. 2. (TRUNK-only) ** Eric, you removed the setting of cfun-calls_setjmp from gcc/ builtins.c (in June). This (re)breaks trunk c.f. 4.6 - given the fix to (1). Was there some reason to remove this? ... would there be some more appropriate test for rs6000.c to use? ... if not, my proposed solution is to re-insert the check in builtins.c to remove the regression w.r.t. to 4.6. 3. There is no multi-lib target set for powerpc64-darwin, thus bootstrap fails with a Bad Alignment error in building the target libs. Since this is a long-standing regression (last bootstrap for powerpc- darwin was likely in the 4.2 era). OK for 4.6 (1, 3) and trunk (1,2 3) ? FTR, the rs6000 change is local to the Darwin port. Iain gcc: * builtins.c (expand_builtin_setjmp_setup): Note that the function calls builtin setjmp. * config/rs6000/rs6000.c (compute_save_world_info): Do not require flag_exceptions to be set when using SjLj. ada: * gcc-interface/Makefile.in (darwin): Adjust LIBGNAT_TARGET_PAIRS for powerpc darwin on the basis of the arch. * system-darwin-ppc64.ads: New file. Index: gcc/builtins.c === --- gcc/builtins.c (revision 178554) +++ gcc/builtins.c (working copy) @@ -815,6 +815,10 @@ expand_builtin_setjmp_setup (rtx buf_addr, rtx rec emit_insn (gen_builtin_setjmp_setup (buf_addr)); #endif + /* This can be tested by a target to determine that the prologue may not use + register-saving functions. */ + cfun-calls_setjmp = 1; + /* We have a nonlocal label. */ cfun-has_nonlocal_label = 1; } Index: gcc/config/rs6000/rs6000.c === --- gcc/config/rs6000/rs6000.c (revision 178554) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -17945,7 +17945,7 @@ compute_save_world_info (rs6000_stack_t *info_ptr) info_ptr-world_save_p = (WORLD_SAVE_P (info_ptr) DEFAULT_ABI == ABI_DARWIN -! (cfun-calls_setjmp flag_exceptions) +!cfun-calls_setjmp info_ptr-first_fp_reg_save == FIRST_SAVED_FP_REGNO info_ptr-first_gp_reg_save == FIRST_SAVED_GP_REGNO info_ptr-first_altivec_reg_save == FIRST_SAVED_ALTIVEC_REGNO Index: gcc/ada/gcc-interface/Makefile.in === --- gcc/ada/gcc-interface/Makefile.in (revision 178554) +++ gcc/ada/gcc-interface/Makefile.in (working copy) @@ -2240,8 +2240,15 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) a-numaux.adsa-numaux-darwin.ads \ a-numaux.adba-numaux-darwin.adb \ g-trasym.adsg-trasym-unimplemented.ads \ -g-trasym.adbg-trasym-unimplemented.adb \ -system.adssystem-darwin-ppc.ads +g-trasym.adbg-trasym-unimplemented.adb + +ifeq ($(strip $(MULTISUBDIR)),/ppc64) + LIBGNAT_TARGET_PAIRS += \ +system.adssystem-darwin-ppc64.ads +else + LIBGNAT_TARGET_PAIRS += \ + system.adssystem-darwin-ppc.ads +endif endif TOOLS_TARGET_PAIRS = \ Index: gcc/ada/system-darwin-ppc64.ads === --- gcc/ada/system-darwin-ppc64.ads (revision 0) +++ gcc/ada/system-darwin-ppc64.ads (revision 0) @@ -0,0 +1,296 @@ + -- + -- -- +--GNAT RUN-TIME COMPONENTS -- + -- -- +-- S Y S T E M-- + -- -- +-- S p e c -- +-- (Darwin/PPC64 Version) -- + -- -- +-- Copyright (C) 2011, Free Software Foundation, Inc. -- + --
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
On Sep 5, 2011, at 11:50 AM, Iain Sandoe develo...@sandoe-acoustics.co.uk wrote: 1. rs6000.c (WORLD_SAVE_P) decides on the use of the out-of-line prologue saves on the basis of cfun-calls_setjmp flag_exceptions. of course, flag_exceptions is NOT set by Ada for SjLj - which is what's used for the compiler build. Ick... It seems wrong to me 15 years later and it still feels like there is too much chewing gum involved. Unless someone has a better idea on how to press forward, I'll ok the Darwin only change to rs6000. I think that the change to turn of fexceptions when doing exceptions is a better way forward, but that is like to be a way more destabilizing change and likely the Ada folks have their reasons why that won't work.