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)] Emit to lto-debug.s file the early debug info.
Date: Fri, 14 Oct 2022 10:26:18 +0000 (GMT)	[thread overview]
Message-ID: <20221014102618.DEB453858C50@sourceware.org> (raw)

https://gcc.gnu.org/g:252410eaac633ec4d9491ee4d4211ce81200dcf0

commit 252410eaac633ec4d9491ee4d4211ce81200dcf0
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Oct 13 21:48:20 2022 +0200

    Emit to lto-debug.s file the early debug info.

Diff:
---
 gcc/dwarf2out.cc | 9 +++++++++
 gcc/output.h     | 1 +
 gcc/varasm.cc    | 6 ++++++
 3 files changed, 16 insertions(+)

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index e81044b8c48..6fde9e56868 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -33044,6 +33044,10 @@ dwarf2out_early_finish (const char *filename)
       || TARGET_PECOFF || TARGET_COFF)
     return;
 
+  FILE *current_asm_file = asm_out_file;
+  asm_out_file = fopen ("/tmp/lto-debug.s", "w");
+  targetm.asm_out.file_start ();
+
   /* Now as we are going to output for LTO initialize sections and labels
      to the LTO variants.  We don't need a random-seed postfix as other
      LTO sections as linking the LTO debug sections into one in a partial
@@ -33168,6 +33172,11 @@ dwarf2out_early_finish (const char *filename)
 				    output_indirect_string> (form);
     }
 
+  targetm.asm_out.file_end ();
+  fclose (asm_out_file);
+  asm_out_file = current_asm_file;
+  wipe_section_cache ();
+
   /* Switch back to the text section.  */
   switch_to_section (text_section);
 }
diff --git a/gcc/output.h b/gcc/output.h
index 6936bdeeb6c..e464efce1d5 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -540,6 +540,7 @@ extern section *get_section (const char *, unsigned int, tree,
 			     bool not_existing = false);
 extern section *get_named_section (tree, const char *, int);
 extern section *get_variable_section (tree, bool);
+extern void wipe_section_cache (void);
 extern void place_block_symbol (rtx);
 extern rtx get_section_anchor (struct object_block *, HOST_WIDE_INT,
 			       enum tls_model);
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index a11184584a2..b7662f2a3d5 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -6658,6 +6658,12 @@ init_varasm_once (void)
 #endif
 }
 
+void
+wipe_section_cache ()
+{
+  section_htab->empty ();
+}
+
 enum tls_model
 decl_default_tls_model (const_tree decl)
 {

                 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=20221014102618.DEB453858C50@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).