// resolve.cc -- symbol resolution for gold
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
}
}
+ // A new weak undefined reference, merging with an old weak
+ // reference, could be a One Definition Rule (ODR) violation --
+ // especially if the types or sizes of the references differ. We'll
+ // store such pairs and look them up later to make sure they
+ // actually refer to the same lines of code. We also check
+ // combinations of weak and strong, which might occur if one case is
+ // inline and the other is not. (Note: not all ODR violations can
+ // be found this way, and not everything this finds is an ODR
+ // violation. But it's helpful to warn about.)
+ bool to_is_ordinary;
+ if (parameters->options().detect_odr_violations()
+ && (sym.get_st_bind() == elfcpp::STB_WEAK
+ || to->binding() == elfcpp::STB_WEAK)
+ && orig_st_shndx != elfcpp::SHN_UNDEF
+ && to->shndx(&to_is_ordinary) != elfcpp::SHN_UNDEF
+ && to_is_ordinary
+ && sym.get_st_size() != 0 // Ignore weird 0-sized symbols.
+ && to->symsize() != 0
+ && (sym.get_st_type() != to->type()
+ || sym.get_st_size() != to->symsize())
+ // C does not have a concept of ODR, so we only need to do this
+ // on C++ symbols. These have (mangled) names starting with _Z.
+ && to->name()[0] == '_' && to->name()[1] == 'Z')
+ {
+ Symbol_location fromloc
+ = { object, orig_st_shndx, sym.get_st_value() };
+ Symbol_location toloc = { to->object(), to->shndx(&to_is_ordinary),
+ to->value() };
+ this->candidate_odr_violations_[to->name()].insert(fromloc);
+ this->candidate_odr_violations_[to->name()].insert(toloc);
+ }
+
unsigned int frombits = symbol_to_bits(sym.get_st_bind(),
object->is_dynamic(),
st_shndx, is_ordinary,
_("multiple common of '%s'"),
to, OBJECT, object);
}
-
- // A new weak undefined reference, merging with an old weak
- // reference, could be a One Definition Rule (ODR) violation --
- // especially if the types or sizes of the references differ. We'll
- // store such pairs and look them up later to make sure they
- // actually refer to the same lines of code. (Note: not all ODR
- // violations can be found this way, and not everything this finds
- // is an ODR violation. But it's helpful to warn about.)
- bool to_is_ordinary;
- if (parameters->options().detect_odr_violations()
- && sym.get_st_bind() == elfcpp::STB_WEAK
- && to->binding() == elfcpp::STB_WEAK
- && orig_st_shndx != elfcpp::SHN_UNDEF
- && to->shndx(&to_is_ordinary) != elfcpp::SHN_UNDEF
- && to_is_ordinary
- && sym.get_st_size() != 0 // Ignore weird 0-sized symbols.
- && to->symsize() != 0
- && (sym.get_st_type() != to->type()
- || sym.get_st_size() != to->symsize())
- // C does not have a concept of ODR, so we only need to do this
- // on C++ symbols. These have (mangled) names starting with _Z.
- && to->name()[0] == '_' && to->name()[1] == 'Z')
- {
- Symbol_location fromloc
- = { object, orig_st_shndx, sym.get_st_value() };
- Symbol_location toloc = { to->object(), to->shndx(&to_is_ordinary),
- to->value() };
- this->candidate_odr_violations_[to->name()].insert(fromloc);
- this->candidate_odr_violations_[to->name()].insert(toloc);
- }
}
// Handle the core of symbol resolution. This is called with the
|| (object != NULL && object->just_symbols()))
return false;
- if (!parameters->options().allow_multiple_definition()
- && !parameters->options().muldefs())
+ if (!parameters->options().muldefs())
Symbol_table::report_resolve_problem(true,
_("multiple definition of '%s'"),
to, defined, object);
// We shouldn't see these flags. If we do, we need to handle them
// somehow.
- gold_assert(!from->is_target_special_ || this->is_target_special_);
gold_assert(!from->is_forwarder_);
- gold_assert(!from->has_plt_offset_);
+ gold_assert(!from->has_plt_offset());
gold_assert(!from->has_warning_);
gold_assert(!from->is_copied_from_dynobj_);
gold_assert(!from->is_forced_local_);
// script to restrict this to only the ones needed for implemented
// targets.
-#ifdef HAVE_TARGET_32_LITTLE
+// We have to instantiate both big and little endian versions because
+// these are used by other templates that depends on size only.
+
+#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
template
void
Symbol_table::resolve<32, false>(
unsigned int orig_st_shndx,
Object* object,
const char* version);
-#endif
-#ifdef HAVE_TARGET_32_BIG
template
void
Symbol_table::resolve<32, true>(
const char* version);
#endif
-#ifdef HAVE_TARGET_64_LITTLE
+#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
template
void
Symbol_table::resolve<64, false>(
unsigned int orig_st_shndx,
Object* object,
const char* version);
-#endif
-#ifdef HAVE_TARGET_64_BIG
template
void
Symbol_table::resolve<64, true>(