public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/experiment-asm-file)] Emit to lto-debug.s file the early 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: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)
 {

^ 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)] Emit to lto-debug.s file the early 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).