This patch works around the lack of simple-object Mach-O support for LTO debug. It disables early debug generation for darwin (retaining the debug setting for the fat part of the LTO objects) which should result in roughly comparable debug for LTO than before the early LTO debug support. "roughly" meaning that we're not fully set up to emit late dwarf without access to early DIEs and thus one may experience extra ICEs - but I'd rather debug those, seeing what we can do, than disabling debug info generation completely.
In the PR Dominique says "With the patch the failures (-m32/-m64) went down from 1059 to 467" which is a nice improvement. I'm not set up to bootstrap on darwin but I expect Dominque did so. So - ok for trunk? Thanks, Richard. 2018-03-01 Richard Biener <rguent...@suse.de> PR target/82005 * config/darwin.c (saved_debug_info_level): New static global. (darwin_asm_lto_start): Disable debug info generation for LTO out. (darwin_asm_lto_end): Restore debug info generation settings. Index: gcc/config/darwin.c =================================================================== --- gcc/config/darwin.c (revision 258061) +++ gcc/config/darwin.c (working copy) @@ -1933,6 +1933,7 @@ static GTY (()) vec<darwin_lto_section_e in darwin_end_file. */ static FILE *lto_asm_out_file, *saved_asm_out_file; static char *lto_asm_out_name; +static enum debug_info_levels saved_debug_info_level; /* Prepare asm_out_file for LTO output. For darwin, this means hiding asm_out_file and switching to an alternative output file. */ @@ -1941,6 +1942,8 @@ darwin_asm_lto_start (void) { gcc_assert (! saved_asm_out_file); saved_asm_out_file = asm_out_file; + saved_debug_info_level = debug_info_level; + debug_info_level = DINFO_LEVEL_NONE; if (! lto_asm_out_name) lto_asm_out_name = make_temp_file (".lto.s"); lto_asm_out_file = fopen (lto_asm_out_name, "a"); @@ -1959,6 +1962,7 @@ darwin_asm_lto_end (void) fclose (lto_asm_out_file); asm_out_file = saved_asm_out_file; saved_asm_out_file = NULL; + debug_info_level = saved_debug_info_level; } static void