Use stdout when printing object file names for -t option.
authorCary Coutant <ccoutant@gmail.com>
Sat, 20 Mar 2021 01:41:12 +0000 (18:41 -0700)
committerCary Coutant <ccoutant@gmail.com>
Sat, 20 Mar 2021 01:41:12 +0000 (18:41 -0700)
gold/
PR gold/27615
* errors.cc (Errors::trace): New method.
(gold_trace): New function.
* errors.h (Errors::trace): New method.
* gold.h (gold_trace): New function.
* object.cc (Input_objects::add_object): Use gold_trace to print
object file names.

gold/ChangeLog
gold/errors.cc
gold/errors.h
gold/gold.h
gold/object.cc

index 9d591df0fec7c3755b76c11b6b16961e2176aa70..e6c0d92db6d5b7fe71bb9298824e2c4fb9fe4fb0 100644 (file)
@@ -1,3 +1,13 @@
+2021-03-19  Cary Coutant  <ccoutant@gmail.com>
+
+       PR gold/27615
+       * errors.cc (Errors::trace): New method.
+       (gold_trace): New function.
+       * errors.h (Errors::trace): New method.
+       * gold.h (gold_trace): New function.
+       * object.cc (Input_objects::add_object): Use gold_trace to print
+       object file names.
+
 2021-03-19  Cary Coutant  <ccoutant@gmail.com>
 
        PR gold/pr23870
index 755e65d71ff5b0ef5b7a8741f624778d44c4fe37..156fd69c306448ec2e91b0bb518bf3047cfbf506 100644 (file)
@@ -128,6 +128,15 @@ Errors::info(const char* format, va_list args)
   fputc('\n', stderr);
 }
 
+// Print a trace message.
+
+void
+Errors::trace(const char* format, va_list args)
+{
+  vfprintf(stdout, format, args);
+  fputc('\n', stdout);
+}
+
 // Report an error at a reloc location.
 
 template<int size, bool big_endian>
@@ -275,6 +284,17 @@ gold_info(const char* format, ...)
   va_end(args);
 }
 
+// Print a trace message (to stdout).
+
+void
+gold_trace(const char* format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  parameters->errors()->trace(format, args);
+  va_end(args);
+}
+
 // Report an error at a location.
 
 template<int size, bool big_endian>
index 34f05cc3612ccb3f1b0eebc97d28d8e984ea5cf4..a6b528c4a6b7bedeba51b62b0b5e597167081bf8 100644 (file)
@@ -68,6 +68,10 @@ class Errors
   void
   info(const char* format, va_list);
 
+  // Print a trace message and continue.
+  void
+  trace(const char* format, va_list);
+
   // Report an error at a reloc location.
   template<int size, bool big_endian>
   void
index aa00255df3c38b749fa1cf788d96f9c43a6c3096..f27542df15de41fdd68694dceff4b3947f494cc1 100644 (file)
@@ -99,6 +99,10 @@ gold_warning(const char* msg, ...) ATTRIBUTE_PRINTF_1;
 extern void
 gold_info(const char* msg, ...) ATTRIBUTE_PRINTF_1;
 
+// This function is called to print a trace message.
+extern void
+gold_trace(const char* msg, ...) ATTRIBUTE_PRINTF_1;
+
 // This function is called to emit an error message and then
 // immediately exit with fallback status (e.g., when
 // --incremental-update fails and the link needs to be restarted
index 5fa6487db5c0d639ae6e0e9e00d9d9a549105a8c..45cf30d4aaf5ee7bc3298f5c3214c15ef3aea33b 100644 (file)
@@ -3199,7 +3199,7 @@ Input_objects::add_object(Object* obj)
 {
   // Print the filename if the -t/--trace option is selected.
   if (parameters->options().trace())
-    gold_info("%s", obj->name().c_str());
+    gold_trace("%s", obj->name().c_str());
 
   if (!obj->is_dynamic())
     this->relobj_list_.push_back(static_cast<Relobj*>(obj));
This page took 0.028678 seconds and 4 git commands to generate.