- was_undefined = ret->is_undefined();
- // 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;
+ }