* Makefile.am (spu_ovl.o_c): Add missing line continuations.
[binutils-gdb.git] / gold / symtab.cc
index 33a9151c3fd30daf21d65831dc009daebfa33de7..90ddfaea077ce19dd5a74a807efe950bfafcb7ee 100644 (file)
@@ -37,6 +37,8 @@
 #include "target.h"
 #include "workqueue.h"
 #include "symtab.h"
+#include "demangle.h"   // needed for --dynamic-list-cpp-new
+#include "plugin.h"
 
 namespace gold
 {
@@ -73,6 +75,7 @@ Symbol::init_fields(const char* name, const char* version,
   this->is_copied_from_dynobj_ = false;
   this->is_forced_local_ = false;
   this->is_ordinary_shndx_ = false;
+  this->in_real_elf_ = false;
 }
 
 // Return the demangled version of the symbol's name, but only
@@ -117,6 +120,7 @@ Symbol::init_base_object(const char* name, const char* version, Object* object,
   this->source_ = FROM_OBJECT;
   this->in_reg_ = !object->is_dynamic();
   this->in_dyn_ = object->is_dynamic();
+  this->in_real_elf_ = object->pluginobj() == NULL;
 }
 
 // Initialize the fields in the base class Symbol for a symbol defined
@@ -133,6 +137,7 @@ Symbol::init_base_output_data(const char* name, const char* version,
   this->u_.in_output_data.offset_is_from_end = offset_is_from_end;
   this->source_ = IN_OUTPUT_DATA;
   this->in_reg_ = true;
+  this->in_real_elf_ = true;
 }
 
 // Initialize the fields in the base class Symbol for a symbol defined
@@ -150,6 +155,7 @@ Symbol::init_base_output_segment(const char* name, const char* version,
   this->u_.in_output_segment.offset_base = offset_base;
   this->source_ = IN_OUTPUT_SEGMENT;
   this->in_reg_ = true;
+  this->in_real_elf_ = true;
 }
 
 // Initialize the fields in the base class Symbol for a symbol defined
@@ -163,6 +169,7 @@ Symbol::init_base_constant(const char* name, const char* version,
   this->init_fields(name, version, type, binding, visibility, nonvis);
   this->source_ = IS_CONSTANT;
   this->in_reg_ = true;
+  this->in_real_elf_ = true;
 }
 
 // Initialize the fields in the base class Symbol for an undefined
@@ -174,8 +181,10 @@ Symbol::init_base_undefined(const char* name, const char* version,
                            elfcpp::STV visibility, unsigned char nonvis)
 {
   this->init_fields(name, version, type, binding, visibility, nonvis);
+  this->dynsym_index_ = -1U;
   this->source_ = IS_UNDEFINED;
   this->in_reg_ = true;
+  this->in_real_elf_ = true;
 }
 
 // Allocate a common symbol in the base.
@@ -280,6 +289,9 @@ Sized_symbol<size>::allocate_common(Output_data* od, Value_type value)
   this->value_ = value;
 }
 
+// The ""'s around str ensure str is a string literal, so sizeof works.
+#define strprefix(var, str)   (strncmp(var, str, sizeof("" str "") - 1) == 0)
+
 // Return true if this symbol should be added to the dynamic symbol
 // table.
 
@@ -294,6 +306,48 @@ Symbol::should_add_dynsym_entry() const
   if (this->is_forced_local())
     return false;
 
+  // If the symbol was forced dynamic in a --dynamic-list file, add it.
+  if (parameters->options().in_dynamic_list(this->name()))
+    return true;
+
+  // If dynamic-list-data was specified, add any STT_OBJECT.
+  if (parameters->options().dynamic_list_data()
+      && !this->is_from_dynobj()
+      && this->type() == elfcpp::STT_OBJECT)
+    return true;
+
+  // If --dynamic-list-cpp-new was specified, add any new/delete symbol.
+  // If --dynamic-list-cpp-typeinfo was specified, add any typeinfo symbols.
+  if ((parameters->options().dynamic_list_cpp_new()
+       || parameters->options().dynamic_list_cpp_typeinfo())
+      && !this->is_from_dynobj())
+    {
+      // TODO(csilvers): We could probably figure out if we're an operator
+      //                 new/delete or typeinfo without the need to demangle.
+      char* demangled_name = cplus_demangle(this->name(),
+                                            DMGL_ANSI | DMGL_PARAMS);
+      if (demangled_name == NULL)
+        {
+          // Not a C++ symbol, so it can't satisfy these flags
+        }
+      else if (parameters->options().dynamic_list_cpp_new()
+               && (strprefix(demangled_name, "operator new")
+                   || strprefix(demangled_name, "operator delete")))
+        {
+          free(demangled_name);
+          return true;
+        }
+      else if (parameters->options().dynamic_list_cpp_typeinfo()
+               && (strprefix(demangled_name, "typeinfo name for")
+                   || strprefix(demangled_name, "typeinfo for")))
+        {
+          free(demangled_name);
+          return true;
+        }
+      else
+        free(demangled_name);
+    }
+
   // If exporting all symbols or building a shared library,
   // and the symbol is defined in a regular object and is
   // externally visible, we need to add it.
@@ -356,6 +410,7 @@ Symbol::output_section() const
        if (shndx != elfcpp::SHN_UNDEF && this->is_ordinary_shndx_)
          {
            gold_assert(!this->u_.from_object.object->is_dynamic());
+           gold_assert(this->u_.from_object.object->pluginobj() == NULL);
            Relobj* relobj = static_cast<Relobj*>(this->u_.from_object.object);
            return relobj->output_section(shndx);
          }
@@ -489,8 +544,7 @@ Symbol_table::lookup(const char* name, const char* version) const
 
 template<int size, bool big_endian>
 void
-Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from,
-                     const char* version)
+Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from)
 {
   unsigned char buf[elfcpp::Elf_sizes<size>::sym_size];
   elfcpp::Sym_write<size, big_endian> esym(buf);
@@ -502,7 +556,7 @@ Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from,
   bool is_ordinary;
   unsigned int shndx = from->shndx(&is_ordinary);
   this->resolve(to, esym.sym(), shndx, is_ordinary, shndx, from->object(),
-               version);
+               from->version());
   if (from->in_reg())
     to->set_in_reg();
   if (from->in_dyn())
@@ -687,23 +741,58 @@ Symbol_table::add_from_object(Object* object,
              // NAME/NULL point to NAME/VERSION.
              insdef.first->second = ret;
            }
-         else if (insdef.first->second != ret
-                  && insdef.first->second->is_undefined())
+         else if (insdef.first->second != ret)
            {
              // This is the unfortunate case where we already have
-             // entries for both NAME/VERSION and NAME/NULL.  Note
-             // that we don't want to combine them if the existing
-             // symbol is going to override the new one.  FIXME: We
-             // currently just test is_undefined, but this may not do
-             // the right thing if the existing symbol is from a
-             // shared library and the new one is from a regular
-             // object.
-
-             const Sized_symbol<size>* sym2;
-             sym2 = this->get_sized_symbol<size>(insdef.first->second);
-             Symbol_table::resolve<size, big_endian>(ret, sym2, version);
-             this->make_forwarder(insdef.first->second, ret);
-             insdef.first->second = ret;
+             // entries for both NAME/VERSION and NAME/NULL.  We now
+             // see a symbol NAME/VERSION where VERSION is the
+             // default version.  We have already resolved this new
+             // symbol with the existing NAME/VERSION symbol.
+
+             // It's possible that NAME/NULL and NAME/VERSION are
+             // both defined in regular objects.  This can only
+             // happen if one object file defines foo and another
+             // defines foo@@ver.  This is somewhat obscure, but we
+             // call it a multiple definition error.
+
+             // It's possible that NAME/NULL actually has a version,
+             // in which case it won't be the same as VERSION.  This
+             // happens with ver_test_7.so in the testsuite for the
+             // symbol t2_2.  We see t2_2@@VER2, so we define both
+             // t2_2/VER2 and t2_2/NULL.  We then see an unadorned
+             // t2_2 in an object file and give it version VER1 from
+             // the version script.  This looks like a default
+             // definition for VER1, so it looks like we should merge
+             // t2_2/NULL with t2_2/VER1.  That doesn't make sense,
+             // but it's not obvious that this is an error, either.
+             // So we just punt.
+
+             // If one of the symbols has non-default visibility, and
+             // the other is defined in a shared object, then they
+             // are different symbols.
+
+             // Otherwise, we just resolve the symbols as though they
+             // were the same.
+
+             if (insdef.first->second->version() != NULL)
+               {
+                 gold_assert(insdef.first->second->version() != version);
+                 def = false;
+               }
+             else if (ret->visibility() != elfcpp::STV_DEFAULT
+                 && insdef.first->second->is_from_dynobj())
+               def = false;
+             else if (insdef.first->second->visibility() != elfcpp::STV_DEFAULT
+                      && ret->is_from_dynobj())
+               def = false;
+             else
+               {
+                 const Sized_symbol<size>* sym2;
+                 sym2 = this->get_sized_symbol<size>(insdef.first->second);
+                 Symbol_table::resolve<size, big_endian>(ret, sym2);
+                 this->make_forwarder(insdef.first->second, ret);
+                 insdef.first->second = ret;
+               }
            }
          else
            def = false;
@@ -800,8 +889,11 @@ Symbol_table::add_from_relobj(
     size_t symndx_offset,
     const char* sym_names,
     size_t sym_name_size,
-    typename Sized_relobj<size, big_endian>::Symbols* sympointers)
+    typename Sized_relobj<size, big_endian>::Symbols* sympointers,
+    size_t *defined)
 {
+  *defined = 0;
+
   gold_assert(size == relobj->target()->get_size());
   gold_assert(size == parameters->target().get_size());
 
@@ -812,6 +904,8 @@ Symbol_table::add_from_relobj(
   const unsigned char* p = syms;
   for (size_t i = 0; i < count; ++i, p += sym_size)
     {
+      (*sympointers)[i] = NULL;
+
       elfcpp::Sym<size, big_endian> sym(p);
 
       unsigned int st_name = sym.get_st_name();
@@ -832,6 +926,9 @@ Symbol_table::add_from_relobj(
       if (!is_ordinary)
        orig_st_shndx = elfcpp::SHN_UNDEF;
 
+      if (st_shndx != elfcpp::SHN_UNDEF)
+       ++*defined;
+
       // A symbol defined in a section which we are not including must
       // be treated as an undefined symbol.
       if (st_shndx != elfcpp::SHN_UNDEF
@@ -843,6 +940,7 @@ Symbol_table::add_from_relobj(
       // name from the version name.  If there are two '@' characters,
       // this is the default version.
       const char* ver = strchr(name, '@');
+      Stringpool::Key ver_key = 0;
       int namelen = 0;
       // DEF: is the version default?  LOCAL: is the symbol forced local?
       bool def = false;
@@ -858,26 +956,37 @@ Symbol_table::add_from_relobj(
              def = true;
              ++ver;
            }
+         ver = this->namepool_.add(ver, true, &ver_key);
         }
       // We don't want to assign a version to an undefined symbol,
       // even if it is listed in the version script.  FIXME: What
       // about a common symbol?
-      else if (!version_script_.empty()
-              && st_shndx != elfcpp::SHN_UNDEF)
-        {
-          // The symbol name did not have a version, but
-          // the version script may assign a version anyway.
-          namelen = strlen(name);
-          def = true;
-          // Check the global: entries from the version script.
-          const std::string& version =
-              version_script_.get_symbol_version(name);
-          if (!version.empty())
-            ver = version.c_str();
-          // Check the local: entries from the version script
-          if (version_script_.symbol_is_local(name))
-            local = true;
-        }
+      else
+       {
+         namelen = strlen(name);
+         if (!this->version_script_.empty()
+             && st_shndx != elfcpp::SHN_UNDEF)
+           {
+             // The symbol name did not have a version, but the
+             // version script may assign a version anyway.
+             std::string version;
+             if (this->version_script_.get_symbol_version(name, &version))
+               {
+                 // The version can be empty if the version script is
+                 // only used to force some symbols to be local.
+                 if (!version.empty())
+                   {
+                     ver = this->namepool_.add_with_length(version.c_str(),
+                                                           version.length(),
+                                                           true,
+                                                           &ver_key);
+                     def = true;
+                   }
+               }
+             else if (this->version_script_.symbol_is_local(name))
+               local = true;
+           }
+       }
 
       elfcpp::Sym<size, big_endian>* psym = &sym;
       unsigned char symbuf[sym_size];
@@ -902,34 +1011,84 @@ Symbol_table::add_from_relobj(
          psym = &sym2;
        }
 
+      Stringpool::Key name_key;
+      name = this->namepool_.add_with_length(name, namelen, true,
+                                            &name_key);
+
       Sized_symbol<size>* res;
-      if (ver == NULL)
-       {
-         Stringpool::Key name_key;
-         name = this->namepool_.add(name, true, &name_key);
-         res = this->add_from_object(relobj, name, name_key, NULL, 0,
-                                     false, *psym, st_shndx, is_ordinary,
-                                     orig_st_shndx);
-          if (local)
-           this->force_local(res);
-       }
-      else
-       {
-         Stringpool::Key name_key;
-         name = this->namepool_.add_with_length(name, namelen, true,
-                                                &name_key);
-         Stringpool::Key ver_key;
-         ver = this->namepool_.add(ver, true, &ver_key);
+      res = this->add_from_object(relobj, name, name_key, ver, ver_key,
+                                 def, *psym, st_shndx, is_ordinary,
+                                 orig_st_shndx);
 
-         res = this->add_from_object(relobj, name, name_key, ver, ver_key,
-                                     def, *psym, st_shndx, is_ordinary,
-                                     orig_st_shndx);
-       }
+      if (local)
+       this->force_local(res);
 
       (*sympointers)[i] = res;
     }
 }
 
+// Add a symbol from a plugin-claimed file.
+
+template<int size, bool big_endian>
+Symbol*
+Symbol_table::add_from_pluginobj(
+    Sized_pluginobj<size, big_endian>* obj,
+    const char* name,
+    const char* ver,
+    elfcpp::Sym<size, big_endian>* sym)
+{
+  unsigned int st_shndx = sym->get_st_shndx();
+
+  Stringpool::Key ver_key = 0;
+  bool def = false;
+  bool local = false;
+
+  if (ver != NULL)
+    {
+      ver = this->namepool_.add(ver, true, &ver_key);
+    }
+  // We don't want to assign a version to an undefined symbol,
+  // even if it is listed in the version script.  FIXME: What
+  // about a common symbol?
+  else
+    {
+      if (!this->version_script_.empty()
+          && st_shndx != elfcpp::SHN_UNDEF)
+        {
+          // The symbol name did not have a version, but the
+          // version script may assign a version anyway.
+          std::string version;
+          if (this->version_script_.get_symbol_version(name, &version))
+            {
+              // The version can be empty if the version script is
+              // only used to force some symbols to be local.
+              if (!version.empty())
+                {
+                  ver = this->namepool_.add_with_length(version.c_str(),
+                                                        version.length(),
+                                                        true,
+                                                        &ver_key);
+                  def = true;
+                }
+            }
+          else if (this->version_script_.symbol_is_local(name))
+            local = true;
+        }
+    }
+
+  Stringpool::Key name_key;
+  name = this->namepool_.add(name, true, &name_key);
+
+  Sized_symbol<size>* res;
+  res = this->add_from_object(obj, name, name_key, ver, ver_key,
+                             def, *sym, st_shndx, true, st_shndx);
+
+  if (local)
+       this->force_local(res);
+
+  return res;
+}
+
 // Add all the symbols in a dynamic object to the hash table.
 
 template<int size, bool big_endian>
@@ -942,8 +1101,12 @@ Symbol_table::add_from_dynobj(
     size_t sym_name_size,
     const unsigned char* versym,
     size_t versym_size,
-    const std::vector<const char*>* version_map)
+    const std::vector<const char*>* version_map,
+    typename Sized_relobj<size, big_endian>::Symbols* sympointers,
+    size_t* defined)
 {
+  *defined = 0;
+
   gold_assert(size == dynobj->target()->get_size());
   gold_assert(size == parameters->target().get_size());
 
@@ -977,6 +1140,9 @@ Symbol_table::add_from_dynobj(
     {
       elfcpp::Sym<size, big_endian> sym(p);
 
+      if (sympointers != NULL)
+       (*sympointers)[i] = NULL;
+
       // Ignore symbols with local binding or that have
       // internal or hidden visibility.
       if (sym.get_st_bind() == elfcpp::STB_LOCAL
@@ -1012,6 +1178,9 @@ Symbol_table::add_from_dynobj(
       unsigned int st_shndx = dynobj->adjust_sym_shndx(i, psym->get_st_shndx(),
                                                       &is_ordinary);
 
+      if (st_shndx != elfcpp::SHN_UNDEF)
+       ++*defined;
+
       Sized_symbol<size>* res;
 
       if (versym == NULL)
@@ -1107,6 +1276,9 @@ Symbol_table::add_from_dynobj(
          && res->source() == Symbol::FROM_OBJECT
          && res->object() == dynobj)
        object_symbols.push_back(res);
+
+      if (sympointers != NULL)
+       (*sympointers)[i] = res;
     }
 
   this->record_weak_aliases(&object_symbols);
@@ -1215,11 +1387,14 @@ Symbol_table::define_special_symbol(const char** pname, const char** pversion,
 
   // If the caller didn't give us a version, see if we get one from
   // the version script.
+  std::string v;
   if (*pversion == NULL)
     {
-      const std::string& v(this->version_script_.get_symbol_version(*pname));
-      if (!v.empty())
-       *pversion = v.c_str();
+      if (this->version_script_.get_symbol_version(*pname, &v))
+       {
+         if (!v.empty())
+           *pversion = v.c_str();
+       }
     }
 
   if (only_if_ref)
@@ -1984,6 +2159,11 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym)
            value = 0;
            shndx = elfcpp::SHN_UNDEF;
          }
+       else if (symobj->pluginobj() != NULL)
+         {
+           value = 0;
+           shndx = elfcpp::SHN_UNDEF;
+         }
        else if (shndx == elfcpp::SHN_UNDEF)
          value = 0;
        else if (!is_ordinary
@@ -2002,11 +2182,20 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym)
              }
 
             uint64_t secoff64 = relobj->output_section_offset(shndx);
-            Value_type secoff = convert_types<Value_type, uint64_t>(secoff64);
-           if (sym->type() == elfcpp::STT_TLS)
-             value = sym->value() + os->tls_offset() + secoff;
-           else
-             value = sym->value() + os->address() + secoff;
+            if (secoff64 == -1ULL)
+              {
+                // The section needs special handling (e.g., a merge section).
+               value = os->output_address(relobj, shndx, sym->value());
+             }
+            else
+              {
+                Value_type secoff =
+                  convert_types<Value_type, uint64_t>(secoff64);
+               if (sym->type() == elfcpp::STT_TLS)
+                 value = sym->value() + os->tls_offset() + secoff;
+               else
+                 value = sym->value() + os->address() + secoff;
+             }
          }
       }
       break;
@@ -2202,6 +2391,8 @@ Symbol_table::sized_write_globals(const Input_objects* input_objects,
                      dynsym_value = target.dynsym_value(sym);
                    shndx = elfcpp::SHN_UNDEF;
                  }
+               else if (symobj->pluginobj() != NULL)
+                 shndx = elfcpp::SHN_UNDEF;
                else if (in_shndx == elfcpp::SHN_UNDEF
                         || (!is_ordinary
                             && (in_shndx == elfcpp::SHN_ABS
@@ -2299,7 +2490,11 @@ Symbol_table::sized_write_symbol(
   elfcpp::Sym_write<size, big_endian> osym(p);
   osym.put_st_name(pool->get_offset(sym->name()));
   osym.put_st_value(value);
-  osym.put_st_size(sym->symsize());
+  // Use a symbol size of zero for undefined symbols from shared libraries.
+  if (shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj())
+    osym.put_st_size(0);
+  else
+    osym.put_st_size(sym->symsize());
   // A version script may have overridden the default binding.
   if (sym->is_forced_local())
     osym.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL, sym->type()));
@@ -2341,9 +2536,17 @@ Symbol_table::warn_about_undefined_dynobj_symbol(
       // A very ugly cast.
       Dynobj* dynobj = static_cast<Dynobj*>(sym->object());
       if (!dynobj->has_unknown_needed_entries())
-       gold_error(_("%s: undefined reference to '%s'"),
-                  sym->object()->name().c_str(),
-                   sym->demangled_name().c_str());
+        {
+          if (sym->version())
+            gold_error(_("%s: undefined reference to '%s', version '%s'"),
+                       sym->object()->name().c_str(),
+                       sym->demangled_name().c_str(),
+                       sym->version());
+          else
+            gold_error(_("%s: undefined reference to '%s'"),
+                       sym->object()->name().c_str(),
+                       sym->demangled_name().c_str());
+        }
     }
 }
 
@@ -2584,7 +2787,8 @@ Symbol_table::add_from_relobj<32, false>(
     size_t symndx_offset,
     const char* sym_names,
     size_t sym_name_size,
-    Sized_relobj<32, true>::Symbols* sympointers);
+    Sized_relobj<32, false>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #ifdef HAVE_TARGET_32_BIG
@@ -2597,7 +2801,8 @@ Symbol_table::add_from_relobj<32, true>(
     size_t symndx_offset,
     const char* sym_names,
     size_t sym_name_size,
-    Sized_relobj<32, false>::Symbols* sympointers);
+    Sized_relobj<32, true>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #ifdef HAVE_TARGET_64_LITTLE
@@ -2610,7 +2815,8 @@ Symbol_table::add_from_relobj<64, false>(
     size_t symndx_offset,
     const char* sym_names,
     size_t sym_name_size,
-    Sized_relobj<64, true>::Symbols* sympointers);
+    Sized_relobj<64, false>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #ifdef HAVE_TARGET_64_BIG
@@ -2623,7 +2829,48 @@ Symbol_table::add_from_relobj<64, true>(
     size_t symndx_offset,
     const char* sym_names,
     size_t sym_name_size,
-    Sized_relobj<64, false>::Symbols* sympointers);
+    Sized_relobj<64, true>::Symbols* sympointers,
+    size_t* defined);
+#endif
+
+#ifdef HAVE_TARGET_32_LITTLE
+template
+Symbol*
+Symbol_table::add_from_pluginobj<32, false>(
+    Sized_pluginobj<32, false>* obj,
+    const char* name,
+    const char* ver,
+    elfcpp::Sym<32, false>* sym);
+#endif
+
+#ifdef HAVE_TARGET_32_BIG
+template
+Symbol*
+Symbol_table::add_from_pluginobj<32, true>(
+    Sized_pluginobj<32, true>* obj,
+    const char* name,
+    const char* ver,
+    elfcpp::Sym<32, true>* sym);
+#endif
+
+#ifdef HAVE_TARGET_64_LITTLE
+template
+Symbol*
+Symbol_table::add_from_pluginobj<64, false>(
+    Sized_pluginobj<64, false>* obj,
+    const char* name,
+    const char* ver,
+    elfcpp::Sym<64, false>* sym);
+#endif
+
+#ifdef HAVE_TARGET_64_BIG
+template
+Symbol*
+Symbol_table::add_from_pluginobj<64, true>(
+    Sized_pluginobj<64, true>* obj,
+    const char* name,
+    const char* ver,
+    elfcpp::Sym<64, true>* sym);
 #endif
 
 #ifdef HAVE_TARGET_32_LITTLE
@@ -2637,7 +2884,9 @@ Symbol_table::add_from_dynobj<32, false>(
     size_t sym_name_size,
     const unsigned char* versym,
     size_t versym_size,
-    const std::vector<const char*>* version_map);
+    const std::vector<const char*>* version_map,
+    Sized_relobj<32, false>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #ifdef HAVE_TARGET_32_BIG
@@ -2651,7 +2900,9 @@ Symbol_table::add_from_dynobj<32, true>(
     size_t sym_name_size,
     const unsigned char* versym,
     size_t versym_size,
-    const std::vector<const char*>* version_map);
+    const std::vector<const char*>* version_map,
+    Sized_relobj<32, true>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #ifdef HAVE_TARGET_64_LITTLE
@@ -2665,7 +2916,9 @@ Symbol_table::add_from_dynobj<64, false>(
     size_t sym_name_size,
     const unsigned char* versym,
     size_t versym_size,
-    const std::vector<const char*>* version_map);
+    const std::vector<const char*>* version_map,
+    Sized_relobj<64, false>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #ifdef HAVE_TARGET_64_BIG
@@ -2679,7 +2932,9 @@ Symbol_table::add_from_dynobj<64, true>(
     size_t sym_name_size,
     const unsigned char* versym,
     size_t versym_size,
-    const std::vector<const char*>* version_map);
+    const std::vector<const char*>* version_map,
+    Sized_relobj<64, true>::Symbols* sympointers,
+    size_t* defined);
 #endif
 
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)