* script.cc (Version_script_info::get_versions): Don't add empty
	version tag to return value.
	(Version_script_info::get_symbol_version_helper): Change return
	type to bool.  Add pversion parameter.  Change all callers.
	(script_register_vers_node): Don't require a non-NULL tag.
	* script.h (class Version_script_info): Update declarations.
	(Version_script_info::get_symbol_version): Change return type to
	bool.  Add version parameter.  Change all callers.
	* symtab.cc (Sized_symbol::add_from_relobj): Rework version
	handling.  Handle an empty version from a version script.
	(Symbol_table::define_special_symbol): Likewise.
	* testsuite/ver_test_10.script: New file.
	* testsuite/ver_test_10.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
	(check_DATA): Add ver_test_10.syms.
	(ver_test_10.syms, ver_test_10.so): New target.
	* testsuite/Makefile.in: Rebuild.
This commit is contained in:
Ian Lance Taylor 2008-07-23 23:44:02 +00:00
parent e63e4db203
commit 057ead2231
8 changed files with 182 additions and 66 deletions

View file

@ -1732,7 +1732,8 @@ Version_script_info::get_versions() const
{
std::vector<std::string> ret;
for (size_t j = 0; j < version_trees_.size(); ++j)
ret.push_back(version_trees_[j]->tag);
if (!this->version_trees_[j]->tag.empty())
ret.push_back(this->version_trees_[j]->tag);
return ret;
}
@ -1753,9 +1754,16 @@ Version_script_info::get_dependencies(const char* version) const
return ret;
}
const std::string&
// Look up SYMBOL_NAME in the list of versions. If CHECK_GLOBAL is
// true look at the globally visible symbols, otherwise look at the
// symbols listed as "local:". Return true if the symbol is found,
// false otherwise. If the symbol is found, then if PVERSION is not
// NULL, set *PVERSION to the version.
bool
Version_script_info::get_symbol_version_helper(const char* symbol_name,
bool check_global) const
bool check_global,
std::string* pversion) const
{
for (size_t j = 0; j < version_trees_.size(); ++j)
{
@ -1796,11 +1804,14 @@ Version_script_info::get_symbol_version_helper(const char* symbol_name,
if (demangled_name != NULL)
free(demangled_name);
if (matched)
return version_trees_[j]->tag;
{
if (pversion != NULL)
*pversion = this->version_trees_[j]->tag;
return true;
}
}
}
static const std::string empty = "";
return empty;
return false;
}
struct Version_dependency_list*
@ -2207,9 +2218,9 @@ script_register_vers_node(void*,
struct Version_dependency_list *deps)
{
gold_assert(tree != NULL);
gold_assert(tag != NULL);
tree->dependencies = deps;
tree->tag = std::string(tag, taglen);
if (tag != NULL)
tree->tag = std::string(tag, taglen);
}
// Add a dependencies to the list of existing dependencies, if any,