* 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

@ -138,22 +138,17 @@ class Version_script_info
empty() const
{ return this->version_trees_.empty(); }
// Return the version associated with the given symbol name.
// Strings are allocated out of the stringpool given in the
// constructor. Strings are allocated out of the stringpool given
// in the constructor.
const std::string&
get_symbol_version(const char* symbol) const
{ return get_symbol_version_helper(symbol, true); }
// If there is a version associated with SYMBOL, return true, and
// set *VERSION to the version. Otherwise, return false.
bool
get_symbol_version(const char* symbol, std::string* version) const
{ return this->get_symbol_version_helper(symbol, true, version); }
// Return whether this symbol matches the local: section of a
// version script (it doesn't matter which).
// Return whether this symbol matches the local: section of some
// version.
bool
symbol_is_local(const char* symbol) const
{
return (get_symbol_version(symbol).empty()
&& !get_symbol_version_helper(symbol, false).empty());
}
{ return this->get_symbol_version_helper(symbol, false, NULL); }
// Return the names of versions defined in the version script.
// Strings are allocated out of the stringpool given in the
@ -186,8 +181,9 @@ class Version_script_info
void
print_expression_list(FILE* f, const Version_expression_list*) const;
const std::string& get_symbol_version_helper(const char* symbol,
bool check_global) const;
bool get_symbol_version_helper(const char* symbol,
bool check_global,
std::string* pversion) const;
std::vector<struct Version_dependency_list*> dependency_lists_;
std::vector<struct Version_expression_list*> expression_lists_;