2009-10-16 Doug Kwan <dougkwan@google.com>

* dynobj.cc (Versions::Versions): Initialize version_script_.
	Only insert base version symbol definition for a shared object
	if version script defines any version versions.
	(Versions::define_base_version): New method definition.
	(Versions::add_def): Check that base version is not needed.
	(Versions::add_need): Define base version lazily.
	* dynobj.h (Versions::define_base_version): New method declaration.
	(Versions::needs_base_version_): New data member declaration.
	* testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
	(check_DATA): Add no_version_test.stdout.
	(libno_version_test.so, no_version_test.o no_version_test.stdout):
	New make rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/no_version_test.c: New file.
	* testsuite/no_version_test.sh: Ditto.
This commit is contained in:
Doug Kwan
2009-10-16 19:11:32 +00:00
parent 0a8d1bde17
commit c5617f2fb6
7 changed files with 170 additions and 19 deletions

View File

@@ -584,6 +584,10 @@ class Versions
version_index(const Symbol_table*, const Stringpool*,
const Symbol* sym) const;
// Define the base version of a shared library.
void
define_base_version(Stringpool* dynpool);
// We keep a hash table mapping canonicalized name/version pairs to
// a version base.
typedef std::pair<Stringpool::Key, Stringpool::Key> Key;
@@ -616,6 +620,9 @@ class Versions
bool is_finalized_;
// Contents of --version-script, if passed, or NULL.
const Version_script_info& version_script_;
// Whether we need to insert a base version. This is only used for
// shared libaries and is cleared when the base version is defined.
bool needs_base_version_;
};
} // End namespace gold.