public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/experiment-asm-file)] Move asm_out_file creation after early LTO debug info.
Date: Fri, 14 Oct 2022 10:26:23 +0000 (GMT)	[thread overview]
Message-ID: <20221014102623.F14983857BB5@sourceware.org> (raw)

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);

                 reply	other threads:[~2022-10-14 10:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221014102623.F14983857BB5@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).