Line 1... |
Line 1... |
// dynobj.cc -- dynamic object support for gold
|
// dynobj.cc -- dynamic object support for gold
|
|
|
// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
// Written by Ian Lance Taylor <iant@google.com>.
|
// Written by Ian Lance Taylor <iant@google.com>.
|
|
|
// This file is part of gold.
|
// This file is part of gold.
|
|
|
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
Line 1481... |
Line 1481... |
const char* version = dynpool->add(sym->version(), false, &version_key);
|
const char* version = dynpool->add(sym->version(), false, &version_key);
|
|
|
if (!sym->is_from_dynobj() && !sym->is_copied_from_dynobj())
|
if (!sym->is_from_dynobj() && !sym->is_copied_from_dynobj())
|
{
|
{
|
if (parameters->options().shared())
|
if (parameters->options().shared())
|
this->add_def(sym, version, version_key);
|
this->add_def(dynpool, sym, version, version_key);
|
}
|
}
|
else
|
else
|
{
|
{
|
// This is a version reference.
|
// This is a version reference.
|
Dynobj* dynobj = this->get_dynobj_for_sym(symtab, sym);
|
Dynobj* dynobj = this->get_dynobj_for_sym(symtab, sym);
|
Line 1494... |
Line 1494... |
}
|
}
|
|
|
// We've found a symbol SYM defined in version VERSION.
|
// We've found a symbol SYM defined in version VERSION.
|
|
|
void
|
void
|
Versions::add_def(const Symbol* sym, const char* version,
|
Versions::add_def(Stringpool* dynpool, const Symbol* sym, const char* version,
|
Stringpool::Key version_key)
|
Stringpool::Key version_key)
|
{
|
{
|
Key k(version_key, 0);
|
Key k(version_key, 0);
|
Version_base* const vbnull = NULL;
|
Version_base* const vbnull = NULL;
|
std::pair<Version_table::iterator, bool> ins =
|
std::pair<Version_table::iterator, bool> ins =
|
Line 1518... |
Line 1518... |
{
|
{
|
// If we are creating a shared object, it is an error to
|
// If we are creating a shared object, it is an error to
|
// find a definition of a symbol with a version which is not
|
// find a definition of a symbol with a version which is not
|
// in the version script.
|
// in the version script.
|
if (parameters->options().shared())
|
if (parameters->options().shared())
|
|
{
|
gold_error(_("symbol %s has undefined version %s"),
|
gold_error(_("symbol %s has undefined version %s"),
|
sym->demangled_name().c_str(), version);
|
sym->demangled_name().c_str(), version);
|
|
if (this->needs_base_version_)
|
|
this->define_base_version(dynpool);
|
|
}
|
else
|
else
|
// We only insert a base version for shared library.
|
// We only insert a base version for shared library.
|
gold_assert(!this->needs_base_version_);
|
gold_assert(!this->needs_base_version_);
|
|
|
// When creating a regular executable, automatically define
|
// When creating a regular executable, automatically define
|