aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-09-04 17:59:53 +0000
committerIan Lance Taylor <iant@google.com>2007-09-04 17:59:53 +0000
commit64707334c75cdf16a0c2d317fc381c9b158beed9 (patch)
tree68c9b43989de0c0bd2f39287587b05e91d20bb17
parent58ffc3bd2c8bd012a0e1251e8a611c58defc2caf (diff)
downloadgdb-64707334c75cdf16a0c2d317fc381c9b158beed9.zip
gdb-64707334c75cdf16a0c2d317fc381c9b158beed9.tar.gz
gdb-64707334c75cdf16a0c2d317fc381c9b158beed9.tar.bz2
Ignore VER_NDX_LOCAL for an undefined symbol.
-rw-r--r--gold/symtab.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 68ce3b1..e4acb31 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -601,7 +601,15 @@ Symbol_table::add_from_dynobj(
bool hidden = (v & elfcpp::VERSYM_HIDDEN) != 0;
v &= elfcpp::VERSYM_VERSION;
- if (v == static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL))
+ // The Sun documentation says that V can be VER_NDX_LOCAL, or
+ // VER_NDX_GLOBAL, or a version index. The meaning of
+ // VER_NDX_LOCAL is defined as "Symbol has local scope." The
+ // old GNU linker will happily generate VER_NDX_LOCAL for an
+ // undefined symbol. I don't know what the Sun linker will
+ // generate.
+
+ if (v == static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL)
+ && sym.get_st_shndx() != elfcpp::SHN_UNDEF)
{
// This symbol should not be visible outside the object.
continue;
@@ -611,7 +619,8 @@ Symbol_table::add_from_dynobj(
Stringpool::Key name_key;
name = this->namepool_.add(name, &name_key);
- if (v == static_cast<unsigned int>(elfcpp::VER_NDX_GLOBAL))
+ if (v == static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL)
+ || v == static_cast<unsigned int>(elfcpp::VER_NDX_GLOBAL))
{
// This symbol does not have a version.
this->add_from_object(dynobj, name, name_key, NULL, 0, false, sym);