summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2021-03-19 18:41:12 -0700
committerCary Coutant <ccoutant@gmail.com>2021-03-19 18:41:12 -0700
commit35891b4775d860b6fad15765bbf85be2b8101419 (patch)
tree35e314ccd363655ad4822265aa5bf4a169623a0e
parentb218a839358197c1b62200481dc14eb3c8a9a38f (diff)
downloadbinutils-gdb-35891b4775d860b6fad15765bbf85be2b8101419.tar.gz
Use stdout when printing object file names for -t option.
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.
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/errors.cc20
-rw-r--r--gold/errors.h4
-rw-r--r--gold/gold.h4
-rw-r--r--gold/object.cc2
5 files changed, 39 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 9d591df0fec..e6c0d92db6d 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,15 @@
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
* testsuite/aarch64_pr23870_bar.c: Return a magic value.
* testsuite/aarch64_pr23870_foo.c: Check the magic value and return
diff --git a/gold/errors.cc b/gold/errors.cc
index 755e65d71ff..156fd69c306 100644
--- a/gold/errors.cc
+++ b/gold/errors.cc
@@ -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>
diff --git a/gold/errors.h b/gold/errors.h
index 34f05cc3612..a6b528c4a6b 100644
--- a/gold/errors.h
+++ b/gold/errors.h
@@ -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
diff --git a/gold/gold.h b/gold/gold.h
index aa00255df3c..f27542df15d 100644
--- a/gold/gold.h
+++ b/gold/gold.h
@@ -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
diff --git a/gold/object.cc b/gold/object.cc
index 5fa6487db5c..45cf30d4aaf 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -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));