2009-05-19 Doug Kwan <dougkwan@google.com>

* archive.cc (Archive::Archive): Move constructor from archive.h
	to here.  Initialize no_export_.
	(Archive::get_elf_object_for_member): Set no_export flag of object.
	* archive.h (Archive::Archive): Move constructor body to
	archive.cc.
	(Archive::no_export): New method.
	(Archive::no_export_): New field.
	* object.h (Object::Object): Initialize no_export_ to false.
	(Object::no_export, Object::set_no_export): New methods.
	(Object::no_export_): New field.
	* options.cc (General_options::parse_exclude_libs): New method.
	(General_options::check_excluded_libs) Same.
	* options.h (exclude_libs): New option.
	(General_options::check_excluded_libs): New method declaration.
	(General_options::excluded_libs_): New field.
	* symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
	default or protected visibility if an object has no-export flag set.
	testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
	(check_SCRIPTS): Add exclude_libs_test.sh.
	(check_DATA): Add exclude_libs_test.syms.
	(MOSTLYCLEANFILES): Add exclude_libs_test.syms,
	libexclude_libs_test_1.a and libexclude_libs_test_2.a.
	(exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
	exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
	(exclude_libs_test.syms, libexclude_libs_test_1.a,
	libexclude_libs_test_2.a): New rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/exclude_libs_test.c: New file.
	* testsuite/exclude_libs_test.sh: Ditto.
	* testsuite/exclude_libs_test_1.c: Ditto.
	* testsuite/exclude_libs_test_2.c: Ditto.
This commit is contained in:
Cary Coutant
2009-05-19 22:14:17 +00:00
parent c1711530e6
commit 6551490093
13 changed files with 341 additions and 17 deletions

View File

@ -660,6 +660,10 @@ class General_options
DEFINE_string(entry, options::TWO_DASHES, 'e', NULL,
N_("Set program start address"), N_("ADDRESS"));
DEFINE_special(exclude_libs, options::TWO_DASHES, '\0',
N_("Exclude libraries from automatic export"),
N_(("lib,lib ...")));
DEFINE_bool(export_dynamic, options::TWO_DASHES, 'E', false,
N_("Export all dynamic symbols"),
N_("Do not export all dynamic symbols (default)"));
@ -1022,6 +1026,11 @@ class General_options
incremental_disposition() const
{ return this->incremental_disposition_; }
// Return true if S is the name of a library excluded from automatic
// symbol export.
bool
check_excluded_libs (const std::string &s) const;
private:
// Don't copy this structure.
General_options(const General_options&);
@ -1087,6 +1096,8 @@ class General_options
// build (--incremental-changed, --incremental-unchanged or
// --incremental-unknown)
bool implicit_incremental_;
// Libraries excluded from automatic export via --exclude-libs
Unordered_set<std::string> excluded_libs_;
};
// The position-dependent options. We use this to store the state of