Only create a version definition for a shared library. Set the
authorIan Lance Taylor <iant@google.com>
Tue, 11 Sep 2007 22:57:35 +0000 (22:57 +0000)
committerIan Lance Taylor <iant@google.com>
Tue, 11 Sep 2007 22:57:35 +0000 (22:57 +0000)
dynamic symbol index for a version definition when finalizing
versions.

gold/dynobj.cc

index 874b4e7fcb4c4214ad7584067cf708ec4c547ee7..96488d8f84033d1a293adf8f7b91b50590510778 100644 (file)
@@ -1195,7 +1195,10 @@ Versions::record_version(const General_options* options,
   const char* version = dynpool->add(sym->version(), &version_key);
 
   if (!sym->is_from_dynobj())
-    this->add_def(options, sym, version, version_key);
+    {
+      if (options->is_shared())
+        this->add_def(options, sym, version, version_key);
+    }
   else
     {
       // This is a version reference.
@@ -1331,6 +1334,7 @@ Versions::finalize(const Target* target, Symbol_table* symtab,
                                                    elfcpp::STV_DEFAULT, 0,
                                                    false);
          vsym->set_needs_dynsym_entry();
+          vsym->set_dynsym_index(dynsym_index);
          ++dynsym_index;
          syms->push_back(vsym);
          // The name is already in the dynamic pool.