// symtab.cc -- the gold symbol table
-// Copyright (C) 2006-2018 Free Software Foundation, Inc.
+// Copyright (C) 2006-2019 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
add_to_table = true;
add_loc = ins.first;
- if (is_default_version && !insdefault.second)
+ if (is_default_version
+ && !insdefault.second
+ && insdefault.first->second->version() == NULL)
{
// We are adding NAME/VERSION, and it is the default
- // version. We already have an entry for NAME/NULL.
+ // version. We already have an entry for NAME/NULL
+ // that does not already have a version.
oldsym = insdefault.first->second;
*resolve_oldsym = true;
}
Stringpool* dynpool,
Versions* versions)
{
- std::vector<Symbol*> as_needed_sym;
-
// First process all the symbols which have been forced to be local,
// as they must appear before all global symbols.
unsigned int forced_local_count = 0;
syms->push_back(sym);
dynpool->add(sym->name(), false, NULL);
- // If the symbol is defined in a dynamic object and is
- // referenced strongly in a regular object, then mark the
- // dynamic object as needed. This is used to implement
- // --as-needed.
- if (sym->is_from_dynobj()
- && sym->in_reg()
- && !sym->is_undef_binding_weak())
- sym->object()->set_is_needed();
-
// Record any version information, except those from
// as-needed libraries not seen to be needed. Note that the
// is_needed state for such libraries can change in this loop.
|| sym->object()->is_needed())
versions->record_version(this, dynpool, sym);
else
- as_needed_sym.push_back(sym);
+ {
+ if (parameters->options().warn_drop_version())
+ gold_warning(_("discarding version information for "
+ "%s@%s, defined in unused shared library %s "
+ "(linked with --as-needed)"),
+ sym->name(), sym->version(),
+ sym->object()->name().c_str());
+ sym->clear_version();
+ }
}
}
}
- // Process version information for symbols from as-needed libraries.
- for (std::vector<Symbol*>::iterator p = as_needed_sym.begin();
- p != as_needed_sym.end();
- ++p)
- {
- Symbol* sym = *p;
-
- if (sym->object()->is_needed())
- versions->record_version(this, dynpool, sym);
- else
- sym->clear_version();
- }
-
// Finish up the versions. In some cases this may add new dynamic
// symbols.
index = versions->finalize(this, index, syms);