diff options
author | Ian Lance Taylor <iant@google.com> | 2007-11-14 18:44:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-11-14 18:44:58 +0000 |
commit | 78f156961e3ba5ed89e28c0c82ca3c891cfdc017 (patch) | |
tree | 2200e6193feec909770ed91559c0f0749ce3d1ab /gold | |
parent | eb01e199fdf149d5e17945ebe6a413c07d278620 (diff) | |
download | gdb-78f156961e3ba5ed89e28c0c82ca3c891cfdc017.zip gdb-78f156961e3ba5ed89e28c0c82ca3c891cfdc017.tar.gz gdb-78f156961e3ba5ed89e28c0c82ca3c891cfdc017.tar.bz2 |
From Craig Silverstein: Report output file name with ODR violation
warning message.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/gold.cc | 2 | ||||
-rw-r--r-- | gold/symtab.cc | 7 | ||||
-rw-r--r-- | gold/symtab.h | 2 | ||||
-rwxr-xr-x | gold/testsuite/debug_msg.sh | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/gold/gold.cc b/gold/gold.cc index 2f17add..a4f145e 100644 --- a/gold/gold.cc +++ b/gold/gold.cc @@ -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. diff --git a/gold/symtab.cc b/gold/symtab.cc index 539bf32..caac2a7 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -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) diff --git a/gold/symtab.h b/gold/symtab.h index d321122..3d3adbc 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -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. diff --git a/gold/testsuite/debug_msg.sh b/gold/testsuite/debug_msg.sh index 26c8ded..987aab7 100755 --- a/gold/testsuite/debug_msg.sh +++ b/gold/testsuite/debug_msg.sh @@ -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" |