x86-64-biarch
[platform/upstream/binutils.git] / gold / dynobj.cc
index 8ddb3f7..baf8489 100644 (file)
@@ -1,6 +1,6 @@
 // dynobj.cc -- dynamic object support for gold
 
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2006-2014 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -336,6 +336,17 @@ template<int size, bool big_endian>
 void
 Sized_dynobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
+  this->base_read_symbols(sd);
+}
+
+// Read the symbols and sections from a dynamic object.  We read the
+// dynamic symbols, not the normal symbols.  This is common code for
+// all target-specific overrides of do_read_symbols().
+
+template<int size, bool big_endian>
+void
+Sized_dynobj<size, big_endian>::base_read_symbols(Read_symbols_data* sd)
+{
   this->read_section_data(&this->elf_file_, sd);
 
   const unsigned char* const pshdrs = sd->section_headers->data();
@@ -823,7 +834,7 @@ Sized_dynobj<size, big_endian>::do_get_global_symbol_counts(
        && (*p)->source() == Symbol::FROM_OBJECT
        && (*p)->object() == this
        && (*p)->is_defined()
-       && (*p)->dynsym_index() != -1U)
+       && (*p)->has_dynsym_index())
       ++count;
   *used = count;
 }
@@ -1483,7 +1494,7 @@ Versions::record_version(const Symbol_table* symtab,
   if (!sym->is_from_dynobj() && !sym->is_copied_from_dynobj())
     {
       if (parameters->options().shared())
-        this->add_def(sym, version, version_key);
+        this->add_def(dynpool, sym, version, version_key);
     }
   else
     {
@@ -1496,7 +1507,7 @@ Versions::record_version(const Symbol_table* symtab,
 // We've found a symbol SYM defined in version VERSION.
 
 void
-Versions::add_def(const Symbol* sym, const char* version,
+Versions::add_def(Stringpool* dynpool, const Symbol* sym, const char* version,
                  Stringpool::Key version_key)
 {
   Key k(version_key, 0);
@@ -1520,8 +1531,12 @@ Versions::add_def(const Symbol* sym, const char* version,
       // find a definition of a symbol with a version which is not
       // in the version script.
       if (parameters->options().shared())
-       gold_error(_("symbol %s has undefined version %s"),
-                  sym->demangled_name().c_str(), version);
+       {
+         gold_error(_("symbol %s has undefined version %s"),
+                    sym->demangled_name().c_str(), version);
+         if (this->needs_base_version_)
+           this->define_base_version(dynpool);
+       }
       else
        // We only insert a base version for shared library.
        gold_assert(!this->needs_base_version_);