Remove tp_t typedef
[deliverable/binutils-gdb.git] / gold / symtab.cc
index 34551ace7dd9c15a107ef2a982355fb13c0b5dde..238834dce8899eaad3662070b6956b63a67f1839 100644 (file)
@@ -989,7 +989,7 @@ Symbol_table::add_from_object(Object* object,
   // ins.first->second: the value (Symbol*).
   // ins.second: true if new entry was inserted, false if not.
 
-  Sized_symbol<size>* ret;
+  Sized_symbol<size>* ret = NULL;
   bool was_undefined_in_reg;
   bool was_common;
   if (!ins.second)
@@ -1049,17 +1049,42 @@ Symbol_table::add_from_object(Object* object,
          // it, then change it to NAME/VERSION.
          ret = this->get_sized_symbol<size>(insdefault.first->second);
 
-         was_undefined_in_reg = ret->is_undefined() && ret->in_reg();
-         // Commons from plugins are just placeholders.
-         was_common = ret->is_common() && ret->object()->pluginobj() == NULL;
-
-         this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx, object,
-                       version, is_default_version);
-          if (parameters->options().gc_sections())
-            this->gc_mark_dyn_syms(ret);
-         ins.first->second = ret;
+         // If the existing symbol already has a version,
+         // don't override it with the new symbol.
+         // This should only happen when the new symbol
+         // is from a shared library.
+         if (ret->version() != NULL)
+           {
+             if (!object->is_dynamic())
+               {
+                 gold_warning(_("%s: conflicting default version definition"
+                                " for %s@@%s"),
+                              object->name().c_str(), name, version);
+                 if (ret->source() == Symbol::FROM_OBJECT)
+                   gold_info(_("%s: %s: previous definition of %s@@%s here"),
+                             program_name,
+                             ret->object()->name().c_str(),
+                             name, ret->version());
+               }
+             ret = NULL;
+             is_default_version = false;
+           }
+         else
+           {
+             was_undefined_in_reg = ret->is_undefined() && ret->in_reg();
+             // Commons from plugins are just placeholders.
+             was_common = (ret->is_common()
+                           && ret->object()->pluginobj() == NULL);
+
+             this->resolve(ret, sym, st_shndx, is_ordinary, orig_st_shndx,
+                           object, version, is_default_version);
+             if (parameters->options().gc_sections())
+               this->gc_mark_dyn_syms(ret);
+             ins.first->second = ret;
+           }
        }
-      else
+
+      if (ret == NULL)
        {
          was_undefined_in_reg = false;
          was_common = false;
This page took 0.023298 seconds and 4 git commands to generate.