From Craig Silverstein: Report output file name with ODR violation
authorIan Lance Taylor <iant@google.com>
Wed, 14 Nov 2007 18:44:58 +0000 (18:44 +0000)
committerIan Lance Taylor <iant@google.com>
Wed, 14 Nov 2007 18:44:58 +0000 (18:44 +0000)
warning message.

gold/gold.cc
gold/symtab.cc
gold/symtab.h
gold/testsuite/debug_msg.sh

index 2f17add31221c96b3d121182a3359331004b317c..a4f145efba662a9efd61681fe9dee10df361025b 100644 (file)
@@ -186,7 +186,7 @@ queue_middle_tasks(const General_options& options,
 
   // See if any of the input definitions violate the One Definition Rule.
   // TODO: if this is too slow, do this as a task, rather than inline.
-  symtab->detect_odr_violations();
+  symtab->detect_odr_violations(options.output_file_name());
 
   // Define some sections and symbols needed for a dynamic link.  This
   // handles some cases we want to see before we read the relocs.
index 539bf328c5b592fa521766aed48210e6c4847d07..caac2a77fb734f59343e6a90cbb9561c98d21d5e 100644 (file)
@@ -1852,7 +1852,7 @@ Symbol_table::sized_write_section_symbol(const Output_section* os,
 // but apparently different definitions (different source-file/line-no).
 
 void
-Symbol_table::detect_odr_violations() const
+Symbol_table::detect_odr_violations(const char* output_file_name) const
 {
   for (Odr_map::const_iterator it = candidate_odr_violations_.begin();
        it != candidate_odr_violations_.end();
@@ -1881,8 +1881,9 @@ Symbol_table::detect_odr_violations() const
 
       if (line_nums.size() > 1)
         {
-          gold_warning(_("symbol %s defined in multiple places "
-                        "(possible ODR violation):"), symbol_name);
+          gold_warning(_("while linking %s: symbol %s defined in multiple "
+                         "places (possible ODR violation):"),
+                       output_file_name, symbol_name);
           for (std::set<std::string>::const_iterator it2 = line_nums.begin();
                it2 != line_nums.end();
                ++it2)
index d32112256abd4be4f1747912c8f7a48b829667c4..3d3adbcc5a68581f2adfe8225287977f98a74d6c 100644 (file)
@@ -1027,7 +1027,7 @@ class Symbol_table
   // Check candidate_odr_violations_ to find symbols with the same name
   // but apparently different definitions (different source-file/line-no).
   void
-  detect_odr_violations() const;
+  detect_odr_violations(const char* output_file_name) const;
 
   // SYM is defined using a COPY reloc.  Return the dynamic object
   // where the original definition was found.
index 26c8ded960bd12e0d011e2738c8389067f1adcb3..987aab7d6e8915c15b9782a845eded8d0def9f22 100755 (executable)
@@ -56,7 +56,7 @@ check "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.c
 check "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:45: undefined reference to 'undef_int'"
 
 # Check we detected the ODR (One Definition Rule) violation.
-check "warning: symbol Ordering::operator()(int, int) *defined in multiple places (possible ODR violation):"
+check ": symbol Ordering::operator()(int, int) *defined in multiple places (possible ODR violation):"
 check "odr_violation1.cc:5"
 check "odr_violation2.cc:5"
 
This page took 0.029848 seconds and 4 git commands to generate.