mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-03-05 16:09:49 +00:00
* symtab.cc (detect_odr_violations): When reporting an ODR
violation, report an object where the symbol is defined.
This commit is contained in:
parent
c7e2358a88
commit
e5ca47baff
@ -1,3 +1,8 @@
|
|||||||
|
2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
|
||||||
|
|
||||||
|
* symtab.cc (detect_odr_violations): When reporting an ODR
|
||||||
|
violation, report an object where the symbol is defined.
|
||||||
|
|
||||||
2010-06-25 Doug Kwan <dougkwan@google.com>
|
2010-06-25 Doug Kwan <dougkwan@google.com>
|
||||||
|
|
||||||
* arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
|
* arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
|
||||||
|
@ -3014,8 +3014,11 @@ Symbol_table::detect_odr_violations(const Task* task,
|
|||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
const char* symbol_name = it->first;
|
const char* symbol_name = it->first;
|
||||||
// We use a sorted set so the output is deterministic.
|
// Maps from symbol location to a sample object file we found
|
||||||
std::set<std::string, Odr_violation_compare> line_nums;
|
// that location in. We use a sorted map so the location order
|
||||||
|
// is deterministic, but we only store an arbitrary object file
|
||||||
|
// to avoid copying lots of names.
|
||||||
|
std::map<std::string, std::string, Odr_violation_compare> line_nums;
|
||||||
|
|
||||||
for (Unordered_set<Symbol_location, Symbol_location_hash>::const_iterator
|
for (Unordered_set<Symbol_location, Symbol_location_hash>::const_iterator
|
||||||
locs = it->second.begin();
|
locs = it->second.begin();
|
||||||
@ -3034,7 +3037,11 @@ Symbol_table::detect_odr_violations(const Task* task,
|
|||||||
std::string lineno = Dwarf_line_info::one_addr2line(
|
std::string lineno = Dwarf_line_info::one_addr2line(
|
||||||
locs->object, locs->shndx, locs->offset, 16);
|
locs->object, locs->shndx, locs->offset, 16);
|
||||||
if (!lineno.empty())
|
if (!lineno.empty())
|
||||||
line_nums.insert(lineno);
|
{
|
||||||
|
std::string& sample_object = line_nums[lineno];
|
||||||
|
if (sample_object.empty())
|
||||||
|
sample_object = locs->object->name();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_nums.size() > 1)
|
if (line_nums.size() > 1)
|
||||||
@ -3042,10 +3049,12 @@ Symbol_table::detect_odr_violations(const Task* task,
|
|||||||
gold_warning(_("while linking %s: symbol '%s' defined in multiple "
|
gold_warning(_("while linking %s: symbol '%s' defined in multiple "
|
||||||
"places (possible ODR violation):"),
|
"places (possible ODR violation):"),
|
||||||
output_file_name, demangle(symbol_name).c_str());
|
output_file_name, demangle(symbol_name).c_str());
|
||||||
for (std::set<std::string>::const_iterator it2 = line_nums.begin();
|
for (std::map<std::string, std::string>::const_iterator it2 =
|
||||||
it2 != line_nums.end();
|
line_nums.begin();
|
||||||
++it2)
|
it2 != line_nums.end();
|
||||||
fprintf(stderr, " %s\n", it2->c_str());
|
++it2)
|
||||||
|
fprintf(stderr, _(" %s from %s\n"),
|
||||||
|
it2->first.c_str(), it2->second.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We only call one_addr2line() in this function, so we can clear its cache.
|
// We only call one_addr2line() in this function, so we can clear its cache.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user