+
+ if (same_name)
+ {
+ // When overriding a versioned symbol with a special symbol, we
+ // may be changing the version. This will happen if we see a
+ // special symbol such as "_end" defined in a shared object with
+ // one version (from a version script), but we want to define it
+ // here with a different version (from a different version
+ // script).
+ this->version_ = from->version_;
+ }
+ this->type_ = from->type_;
+ this->binding_ = from->binding_;
+ this->override_visibility(from->visibility_);
+ this->nonvis_ = from->nonvis_;
+
+ // Special symbols are always considered to be regular symbols.
+ this->in_reg_ = true;
+
+ if (from->needs_dynsym_entry_)
+ this->needs_dynsym_entry_ = true;
+ if (from->needs_dynsym_value_)
+ this->needs_dynsym_value_ = true;
+
+ this->is_predefined_ = from->is_predefined_;
+
+ // We shouldn't see these flags. If we do, we need to handle them
+ // somehow.
+ gold_assert(!from->is_forwarder_);
+ gold_assert(!from->has_plt_offset());
+ gold_assert(!from->has_warning_);
+ gold_assert(!from->is_copied_from_dynobj_);
+ gold_assert(!from->is_forced_local_);
+}
+
+// Override a symbol with a special symbol.
+
+template<int size>
+void
+Sized_symbol<size>::override_with_special(const Sized_symbol<size>* from)
+{
+ this->override_base_with_special(from);
+ this->value_ = from->value_;
+ this->symsize_ = from->symsize_;
+}
+
+// Override TOSYM with the special symbol FROMSYM. This handles all
+// aliases of TOSYM.
+
+template<int size>
+void
+Symbol_table::override_with_special(Sized_symbol<size>* tosym,
+ const Sized_symbol<size>* fromsym)
+{
+ tosym->override_with_special(fromsym);
+ if (tosym->has_alias())
+ {
+ Symbol* sym = this->weak_aliases_[tosym];
+ gold_assert(sym != NULL);
+ Sized_symbol<size>* ssym = this->get_sized_symbol<size>(sym);
+ do
+ {
+ ssym->override_with_special(fromsym);
+ sym = this->weak_aliases_[ssym];
+ gold_assert(sym != NULL);
+ ssym = this->get_sized_symbol<size>(sym);
+ }
+ while (ssym != tosym);
+ }
+ if (tosym->binding() == elfcpp::STB_LOCAL
+ || ((tosym->visibility() == elfcpp::STV_HIDDEN
+ || tosym->visibility() == elfcpp::STV_INTERNAL)
+ && (tosym->binding() == elfcpp::STB_GLOBAL
+ || tosym->binding() == elfcpp::STB_GNU_UNIQUE
+ || tosym->binding() == elfcpp::STB_WEAK)
+ && !parameters->options().relocatable()))
+ this->force_local(tosym);