aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-14 07:10:20 +0000
committerIan Lance Taylor <iant@google.com>2007-10-14 07:10:20 +0000
commitd20222a1e7d31611f3a805133ea6f37cd6174fa2 (patch)
treedf5722260a31a832c849eb29a35833bcb19f681c
parenta0c4fb0ac6d0ef13a106a7b46396e8592cd2eeb5 (diff)
downloadfsf-binutils-gdb-d20222a1e7d31611f3a805133ea6f37cd6174fa2.zip
fsf-binutils-gdb-d20222a1e7d31611f3a805133ea6f37cd6174fa2.tar.gz
fsf-binutils-gdb-d20222a1e7d31611f3a805133ea6f37cd6174fa2.tar.bz2
Better multiple definition errors.
-rw-r--r--gold/resolve.cc18
-rw-r--r--gold/symtab.h2
2 files changed, 14 insertions, 6 deletions
diff --git a/gold/resolve.cc b/gold/resolve.cc
index 54529d1..b890ed0 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -170,7 +170,8 @@ Symbol_table::resolve(Sized_symbol<size>* to,
}
bool adjust_common_sizes;
- if (Symbol_table::should_override(to, frombits, &adjust_common_sizes))
+ if (Symbol_table::should_override(to, frombits, object,
+ &adjust_common_sizes))
{
typename Sized_symbol<size>::Size_type tosize = to->symsize();
@@ -195,7 +196,7 @@ Symbol_table::resolve(Sized_symbol<size>* to,
bool
Symbol_table::should_override(const Symbol* to, unsigned int frombits,
- bool* adjust_common_sizes)
+ Object* object, bool* adjust_common_sizes)
{
*adjust_common_sizes = false;
@@ -276,8 +277,14 @@ Symbol_table::should_override(const Symbol* to, unsigned int frombits,
{
case DEF * 16 + DEF:
// Two definitions of the same symbol.
- // FIXME: Report locations.
- gold_error(_("multiple definition of %s"), to->name());
+ // FIXME: Do a better job of reporting locations.
+ gold_error(_("%s: multiple definition of %s"),
+ object != NULL ? object->name().c_str() : _("command line"),
+ to->name());
+ gold_error(_("%s: previous definition here"),
+ (to->source() == Symbol::FROM_OBJECT
+ ? to->object()->name().c_str()
+ : _("command line")));
return false;
case WEAK_DEF * 16 + DEF:
@@ -573,7 +580,8 @@ Symbol_table::should_override_with_special(const Symbol* to)
{
bool adjust_common_sizes;
unsigned int frombits = global_flag | regular_flag | def_flag;
- bool ret = Symbol_table::should_override(to, frombits, &adjust_common_sizes);
+ bool ret = Symbol_table::should_override(to, frombits, NULL,
+ &adjust_common_sizes);
gold_assert(!adjust_common_sizes);
return ret;
}
diff --git a/gold/symtab.h b/gold/symtab.h
index 58c0e50..b215f5d 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -944,7 +944,7 @@ class Symbol_table
// Whether we should override a symbol, based on flags in
// resolve.cc.
static bool
- should_override(const Symbol*, unsigned int, bool*);
+ should_override(const Symbol*, unsigned int, Object*, bool*);
// Whether we should override a symbol with a special symbol which
// is automatically defined by the linker.