gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gold / dynobj.cc
index c4852a9f0b9de498c113889057b06157dd4bda81..4c174c106cdecdf918d742dbf73467bb978eb244 100644 (file)
@@ -1,6 +1,6 @@
 // dynobj.cc -- dynamic object support for gold
 
-// Copyright (C) 2006-2015 Free Software Foundation, Inc.
+// Copyright (C) 2006-2020 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -1439,7 +1439,7 @@ Versions::Versions(const Version_script_info& version_script,
                    Stringpool* dynpool)
   : defs_(), needs_(), version_table_(),
     is_finalized_(false), version_script_(version_script),
-    needs_base_version_(parameters->options().shared())
+    needs_base_version_(true)
 {
   if (!this->version_script_.empty())
     {
@@ -1536,8 +1536,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(dynpool, sym, version, version_key);
+      this->add_def(dynpool, sym, version, version_key);
     }
   else
     {
@@ -1574,18 +1573,13 @@ Versions::add_def(Stringpool* dynpool, 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);
-         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_);
-       
+       gold_error(_("symbol %s has undefined version %s"),
+                  sym->demangled_name().c_str(), version);
+
       // When creating a regular executable, automatically define
       // a new version.
+      if (this->needs_base_version_)
+       this->define_base_version(dynpool);
       Verdef* vd = new Verdef(version, std::vector<std::string>(),
                               false, false, false, false);
       this->defs_.push_back(vd);
@@ -1631,7 +1625,7 @@ Versions::add_need(Stringpool* dynpool, const char* filename, const char* name,
   if (vn == NULL)
     {
       // Create base version definition lazily for shared library.
-      if (this->needs_base_version_)
+      if (parameters->options().shared() && this->needs_base_version_)
        this->define_base_version(dynpool);
 
       // We have a new filename.
@@ -1715,8 +1709,6 @@ Versions::version_index(const Symbol_table* symtab, const Stringpool* dynpool,
   Key k;
   if (!sym->is_from_dynobj() && !sym->is_copied_from_dynobj())
     {
-      if (!parameters->options().shared())
-        return elfcpp::VER_NDX_GLOBAL;
       k = Key(version_key, 0);
     }
   else
@@ -1776,7 +1768,10 @@ Versions::symbol_section_contents(const Symbol_table* symtab,
        version_index = this->version_index(symtab, dynpool, *p);
       // If the symbol was defined as foo@V1 instead of foo@@V1, add
       // the hidden bit.
-      if ((*p)->version() != NULL && !(*p)->is_default())
+      if ((*p)->version() != NULL
+         && (*p)->is_defined()
+         && !(*p)->is_default()
+         && !(*p)->from_dyn())
         version_index |= elfcpp::VERSYM_HIDDEN;
       elfcpp::Swap<16, big_endian>::writeval(pbuf + (*p)->dynsym_index() * 2,
                                              version_index);
This page took 0.023671 seconds and 4 git commands to generate.