This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82005] [8 regression] early lto debug creates invalid assembly on Darwin
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Feb 2018 08:33:54 +0000
- Subject: [Bug target/82005] [8 regression] early lto debug creates invalid assembly on Darwin
- Auto-submitted: auto-generated
- References: <bug-82005-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82005
--- Comment #22 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we don't seem to be able to do anything reasonable for GCC 8. This means
triggering the fallback solution of disabling debug for Darwin. There's
multiple possibilities of places to choose from where to do this - the
easiest possibly being where we emit references to the early debug in the
LTO IL. This is all wrapped by targetm.asm_out.lto_start ()/lto_end ()
calls (see cgraphunit.c:ipa_passes()). These are already implemented
by darwin in darwin_asm_lto_{start,end} where it could simply temporarily
adjust debug_info_level to DINFO_LEVEL_NONE. Like with the following.
Can you check whether that solves all immediate issues with compiling
and linking? Of course the LTOed binaries will now have no debug info
for types or decls but what is eventually generated late. You may
experience extra ICEs during this late generation as well so eventually
we have to force -g0 for all lto1 invocations somewhere in (darwin
sepecific?) option override if in_lto_p -- that alone would be another
possible fix but eventually some rudimentary debug info can be generated
with the patch below.
Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c (revision 257612)
+++ 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,7 @@ 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;
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 +1961,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