From 6551490093fe8f141c073324b2c4387ce93fa712 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Tue, 19 May 2009 22:14:17 +0000 Subject: 2009-05-19 Doug Kwan * 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. --- gold/object.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gold/object.h') diff --git a/gold/object.h b/gold/object.h index 97c126d52b1..a2836d04863 100644 --- a/gold/object.h +++ b/gold/object.h @@ -195,7 +195,7 @@ class Object Object(const std::string& name, Input_file* input_file, bool is_dynamic, off_t offset = 0) : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U), - is_dynamic_(is_dynamic), target_(NULL), xindex_(NULL) + is_dynamic_(is_dynamic), target_(NULL), xindex_(NULL), no_export_(false) { input_file->file().add_object(); } virtual ~Object() @@ -463,6 +463,14 @@ class Object searched_for() const { return this->input_file()->will_search_for(); } + bool + no_export() const + { return this->no_export_; } + + void + set_no_export(bool value) + { this->no_export_ = value; } + protected: // Returns NULL for Objects that are not plugin objects. This method // is overridden in the Pluginobj class. @@ -581,6 +589,9 @@ class Object Target* target_; // Many sections for objects with more than SHN_LORESERVE sections. Xindex* xindex_; + // True if exclude this object from automatic symbol export. + // This is used only for archive objects. + bool no_export_; }; // Implement sized_target inline for efficiency. This approach breaks -- cgit v1.2.1