aboutsummaryrefslogtreecommitdiff
path: root/gold/script.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-07-23 23:44:02 +0000
committerIan Lance Taylor <ian@airs.com>2008-07-23 23:44:02 +0000
commit057ead223193b365a6fcd11939a89a63eb4b94e0 (patch)
treefd9512fb7fbf9175087dee104d30fbc7b1982360 /gold/script.cc
parente63e4db2035334827eb3ca4402b766897f5479a8 (diff)
downloadgdb-057ead223193b365a6fcd11939a89a63eb4b94e0.zip
gdb-057ead223193b365a6fcd11939a89a63eb4b94e0.tar.gz
gdb-057ead223193b365a6fcd11939a89a63eb4b94e0.tar.bz2
PR 6647
* 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.
Diffstat (limited to 'gold/script.cc')
-rw-r--r--gold/script.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/gold/script.cc b/gold/script.cc
index 55cd4e6..4bfe33c 100644
--- a/gold/script.cc
+++ b/gold/script.cc
@@ -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,