gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gold / main.cc
index 4e3295d6f0cfd75a135f9a17bee968d7cd3d3c94..cc86352a96ca44e5fd99226795dcba2d9ed7bbfa 100644 (file)
@@ -1,6 +1,6 @@
 // main.cc -- gold main function.
 
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2006-2020 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -33,6 +33,7 @@
 
 #include "script.h"
 #include "options.h"
+#include "target-select.h"
 #include "parameters.h"
 #include "errors.h"
 #include "mapfile.h"
@@ -46,6 +47,7 @@
 #include "gc.h"
 #include "icf.h"
 #include "incremental.h"
+#include "gdb-index.h"
 #include "timer.h"
 
 using namespace gold;
@@ -164,7 +166,10 @@ main(int argc, char** argv)
 
   Timer timer;
   if (command_line.options().stats())
-    timer.start();
+    {
+      timer.start();
+      set_parameters_timer(&timer);
+    }
 
   // Store some options in the globally accessible parameters.
   set_parameters_options(&command_line.options());
@@ -195,10 +200,6 @@ main(int argc, char** argv)
   if (parameters->options().relocatable())
     command_line.script_options().version_script_info()->clear();
 
-  // Load plugin libraries.
-  if (command_line.options().has_plugins())
-    command_line.options().plugins()->load_plugins();
-
   // The work queue.
   Workqueue workqueue(command_line.options());
 
@@ -234,6 +235,10 @@ main(int argc, char** argv)
   if (parameters->options().section_ordering_file())
     layout.read_layout_from_file();
 
+  // Load plugin libraries.
+  if (command_line.options().has_plugins())
+    command_line.options().plugins()->load_plugins(&layout);
+
   // Get the search path from the -L options.
   Dirsearch search_path;
   search_path.initialize(&workqueue, &command_line.options().library_path());
@@ -246,9 +251,37 @@ main(int argc, char** argv)
   // Run the main task processing loop.
   workqueue.process(0);
 
+  if (command_line.options().print_output_format())
+    print_output_format();
+
   if (command_line.options().stats())
     {
-      Timer::TimeStats elapsed = timer.get_elapsed_time();
+      timer.stamp(2);
+      Timer::TimeStats elapsed = timer.get_pass_time(0);
+      fprintf(stderr,
+             _("%s: initial tasks run time: " \
+               "(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"),
+              program_name,
+              elapsed.user / 1000, (elapsed.user % 1000) * 1000,
+              elapsed.sys / 1000, (elapsed.sys % 1000) * 1000,
+              elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
+      elapsed = timer.get_pass_time(1);
+      fprintf(stderr,
+             _("%s: middle tasks run time: " \
+               "(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"),
+              program_name,
+              elapsed.user / 1000, (elapsed.user % 1000) * 1000,
+              elapsed.sys / 1000, (elapsed.sys % 1000) * 1000,
+              elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
+      elapsed = timer.get_pass_time(2);
+      fprintf(stderr,
+             _("%s: final tasks run time: " \
+               "(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"),
+              program_name,
+              elapsed.user / 1000, (elapsed.user % 1000) * 1000,
+              elapsed.sys / 1000, (elapsed.sys % 1000) * 1000,
+              elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
+      elapsed = timer.get_elapsed_time();
       fprintf(stderr,
              _("%s: total run time: " \
                "(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)\n"),
@@ -259,8 +292,8 @@ main(int argc, char** argv)
 
 #ifdef HAVE_MALLINFO
       struct mallinfo m = mallinfo();
-      fprintf(stderr, _("%s: total space allocated by malloc: %d bytes\n"),
-             program_name, m.arena);
+      fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"),
+             program_name, static_cast<long long>(m.arena));
 #endif
       File_read::print_stats();
       Archive::print_stats();
@@ -269,6 +302,8 @@ main(int argc, char** argv)
              program_name, static_cast<long long>(layout.output_file_size()));
       symtab.print_stats();
       layout.print_stats();
+      Gdb_index::print_stats();
+      Free_list::print_stats();
     }
 
   // Issue defined symbol report.
@@ -290,6 +325,8 @@ main(int argc, char** argv)
 
   // If the user used --noinhibit-exec, we force the exit status to be
   // successful.  This is compatible with GNU ld.
-  gold_exit(errors.error_count() == 0
-           || parameters->options().noinhibit_exec());
+  gold_exit((errors.error_count() == 0
+            || parameters->options().noinhibit_exec())
+           ? GOLD_OK
+           : GOLD_ERR);
 }
This page took 0.025258 seconds and 4 git commands to generate.