[gcc(refs/users/marxin/heads/experiment-asm-file)] Test it.

Martin Liska marxin@gcc.gnu.org
Mon Aug 22 11:38:32 GMT 2022


https://gcc.gnu.org/g:7d8f51e1ae8c694c86977fb490b4b6187e3346f8

commit 7d8f51e1ae8c694c86977fb490b4b6187e3346f8
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Aug 22 13:38:14 2022 +0200

    Test it.

Diff:
---
 gcc/cgraphunit.cc | 1 +
 gcc/lto/lto.cc    | 1 +
 gcc/toplev.cc     | 9 +++++----
 gcc/toplev.h      | 2 ++
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index 7b5be0f1539..5f09e2d8f87 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -2520,6 +2520,7 @@ symbol_table::finalize_compilation_unit (void)
 
       /* Clean up anything that needs cleaning up after initial debug
 	 generation.  */
+      init_asm_output ();
       debuginfo_early_start ();
       (*debug_hooks->early_finish) (main_input_filename);
       debuginfo_early_stop ();
diff --git a/gcc/lto/lto.cc b/gcc/lto/lto.cc
index c82307f4f7e..8893a9fd741 100644
--- a/gcc/lto/lto.cc
+++ b/gcc/lto/lto.cc
@@ -684,6 +684,7 @@ lto_main (void)
 
 	  /* Let the middle end know that we have read and merged all of
 	     the input files.  */
+	  init_asm_output();
 	  symtab->compile ();
 
 	  timevar_stop (TV_PHASE_OPT_GEN);
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 61d234a9ef4..3d78b53e753 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -106,7 +106,6 @@ along with GCC; see the file COPYING3.  If not see
 static void general_init (const char *, bool);
 static void backend_init (void);
 static int lang_dependent_init (const char *);
-static void init_asm_output (const char *);
 static void finalize (bool);
 
 static void crash_signal (int) ATTRIBUTE_NORETURN;
@@ -683,14 +682,16 @@ print_version (FILE *file, const char *indent, bool show_global_state)
 }
 
 
+static const char *asm_name;
 
 /* Open assembly code output file.  Do this even if -fsyntax-only is
    on, because then the driver will have provided the name of a
    temporary file or bit bucket for us.  NAME is the file specified on
    the command line, possibly NULL.  */
-static void
-init_asm_output (const char *name)
+void
+init_asm_output ()
 {
+  const char *name = asm_name;
   if (name == NULL && asm_file_name == 0)
     asm_out_file = stdout;
   else
@@ -1839,7 +1840,7 @@ lang_dependent_init (const char *name)
 
   if (!flag_wpa)
     {
-      init_asm_output (name);
+      asm_name = xstrdup (name);
 
       if (!flag_generate_lto && !flag_compare_debug)
 	{
diff --git a/gcc/toplev.h b/gcc/toplev.h
index a82ef8b8fd3..caedfc616c0 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -99,4 +99,6 @@ extern void parse_alignment_opts (void);
 
 extern void initialize_rtl (void);
 
+extern void init_asm_output (void);
+
 #endif /* ! GCC_TOPLEV_H */


More information about the Gcc-cvs mailing list