The following ignores -gsplit-dwarf when doing LTO since its model seems to be fundamentally incompatible, see my last comment in the now suspended PR.
Bootstrap & regtest running on x86_64-unknown-linux-gnu, I'll apply this to trunk and GCC 8 branch. Richard. 2019-03-19 Richard Biener <[email protected]> PR debug/88389 * opts.c (finish_options): Disable -gsplit-dwarf when doing LTO. Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 269793) +++ gcc/opts.c (working copy) @@ -1077,6 +1077,14 @@ finish_options (struct gcc_options *opts "linker plugin"); opts->x_flag_fat_lto_objects = 1; } + + /* -gsplit-dwarf isn't compatible with LTO, see PR88389. */ + if (opts->x_dwarf_split_debug_info) + { + inform (loc, "%<-gsplit-dwarf%> is not supported with LTO," + " disabling"); + opts->x_dwarf_split_debug_info = 0; + } } /* We initialize opts->x_flag_split_stack to -1 so that targets can set a
