lto-dump: Do not print output file
authorMartin Liska <mliska@suse.cz>
Mon, 4 Jul 2022 14:32:51 +0000 (16:32 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 8 Jul 2022 10:52:47 +0000 (12:52 +0200)
Right now the following is printed:

lto-dump
.file "<artificial>"
.ident "GCC: (GNU) 13.0.0 20220707 (experimental)"
.section .note.GNU-stack,"",@progbits

After the patch we print -help and do not emit any assembly output:

lto-dump
Usage: lto-dump [OPTION]... SUB_COMMAND [OPTION]...

LTO dump tool command line options.

  -list [options]           Dump the symbol list.
    -demangle               Dump the demangled output.
    -defined-only           Dump only the defined symbols.
...

gcc/lto/ChangeLog:

* lto-dump.cc (lto_main): Exit in the function
as we don't want any LTO bytecode processing.

gcc/ChangeLog:

* toplev.cc (init_asm_output): Do not init asm_out_file.

gcc/lto/lto-dump.cc
gcc/toplev.cc

index f88486b..f3d852d 100644 (file)
@@ -316,7 +316,10 @@ lto_main (void)
 {
   quiet_flag = true;
   if (flag_lto_dump_tool_help)
-    dump_tool_help ();
+    {
+      dump_tool_help ();
+      exit (SUCCESS_EXIT_CODE);
+    }
 
   /* LTO is called as a front end, even though it is not a front end.
      Because it is called as a front end, TV_PHASE_PARSING and
@@ -369,11 +372,12 @@ lto_main (void)
     {
       /* Dump specific gimple body of specified function.  */
       dump_body ();
-      return;
     }
   else if (flag_dump_callgraph)
-    {
-      dump_symtab_graphviz ();
-      return;
-    }
+    dump_symtab_graphviz ();
+  else
+    dump_tool_help ();
+
+  /* Exit right now.  */
+  exit (SUCCESS_EXIT_CODE);
 }
index a24ad5d..61d234a 100644 (file)
@@ -721,7 +721,7 @@ init_asm_output (const char *name)
                     "cannot open %qs for writing: %m", asm_file_name);
     }
 
-  if (!flag_syntax_only)
+  if (!flag_syntax_only && !(global_dc->lang_mask & CL_LTODump))
     {
       targetm.asm_out.file_start ();