public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/experiment-asm-file)] Move asm_out_file creation after early LTO debug info.
@ 2022-10-14 10:26 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-10-14 10:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0914ca9f9bf13c16e0191f7a4542eb18fb8e52f8

commit 0914ca9f9bf13c16e0191f7a4542eb18fb8e52f8
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Oct 14 12:23:00 2022 +0200

    Move asm_out_file creation after early LTO debug info.

Diff:
---
 gcc/cgraphunit.cc | 5 +++--
 gcc/dwarf2out.cc  | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index a92b2529758..b13fd5a2b8a 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -2520,11 +2520,12 @@ symbol_table::finalize_compilation_unit (void)
 
       /* Clean up anything that needs cleaning up after initial debug
 	 generation.  */
-      if (asm_out_file == NULL)
-	init_asm_output ();
       debuginfo_early_start ();
       (*debug_hooks->early_finish) (main_input_filename);
       debuginfo_early_stop ();
+
+      if (asm_out_file == NULL)
+	init_asm_output ();
     }
 
   /* Finally drive the pass manager.  */
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 6fde9e56868..8addd6ce3f3 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -33044,7 +33044,7 @@ dwarf2out_early_finish (const char *filename)
       || TARGET_PECOFF || TARGET_COFF)
     return;
 
-  FILE *current_asm_file = asm_out_file;
+  gcc_assert (asm_out_file == NULL);
   asm_out_file = fopen ("/tmp/lto-debug.s", "w");
   targetm.asm_out.file_start ();
 
@@ -33174,8 +33174,8 @@ dwarf2out_early_finish (const char *filename)
 
   targetm.asm_out.file_end ();
   fclose (asm_out_file);
-  asm_out_file = current_asm_file;
   wipe_section_cache ();
+  init_asm_output ();
 
   /* Switch back to the text section.  */
   switch_to_section (text_section);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-14 10:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 10:26 [gcc(refs/users/marxin/heads/experiment-asm-file)] Move asm_out_file creation after early LTO debug info Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).