diff options
author | Craig Silverstein <csilvers@google.com> | 2009-09-18 20:03:22 +0000 |
---|---|---|
committer | Craig Silverstein <csilvers@google.com> | 2009-09-18 20:03:22 +0000 |
commit | 8c60465154ed694fac2531f65e7ca1ae51093174 (patch) | |
tree | 5b1e1c166e0d5f50c40988974cf4a87e9dfcb216 /gold/options.h | |
parent | f43030c448dc1938d6fc7a6072f1a76853b1b70d (diff) | |
download | gdb-8c60465154ed694fac2531f65e7ca1ae51093174.zip gdb-8c60465154ed694fac2531f65e7ca1ae51093174.tar.gz gdb-8c60465154ed694fac2531f65e7ca1ae51093174.tar.bz2 |
* object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
* options.cc: Include <cerrno> and <fstream>.
(General_options::finalize): Parse -retain-symbols-file tag.
* options.h: New flag.
(General_options): New method should_retain_symbol, new
variable symbols_to_retain.
* symtab.cc (Symbol_table::sized_finalize_symbol): Test
should_retain_symbol map.
* testsuite/Makefile.am (retain_symbols_file_test): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/retain_symbols_file_test.sh: New file.
Diffstat (limited to 'gold/options.h')
-rw-r--r-- | gold/options.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gold/options.h b/gold/options.h index 3f14529..258d628 100644 --- a/gold/options.h +++ b/gold/options.h @@ -774,6 +774,9 @@ class General_options DEFINE_bool(relax, options::TWO_DASHES, '\0', false, N_("Relax branches on certain targets"), NULL); + DEFINE_string(retain_symbols_file, options::EXACTLY_ONE_DASH, '\0', NULL, + N_("keep only symbols listed in this file"), N_("[file]")); + // -R really means -rpath, but can mean --just-symbols for // compatibility with GNU ld. -rpath is always -rpath, so we list // it separately. @@ -1021,6 +1024,15 @@ class General_options bool is_in_system_directory(const std::string& name) const; + // RETURN whether SYMBOL_NAME should be kept, according to symbols_to_retain_. + bool + should_retain_symbol(const char* symbol_name) const + { + if (symbols_to_retain_.empty()) // means flag wasn't specified + return true; + return symbols_to_retain_.find(symbol_name) != symbols_to_retain_.end(); + } + // These are the best way to get access to the execstack state, // not execstack() and noexecstack() which are hard to use properly. bool @@ -1132,8 +1144,10 @@ class General_options // build (--incremental-changed, --incremental-unchanged or // --incremental-unknown) bool implicit_incremental_; - // Libraries excluded from automatic export via --exclude-libs + // Libraries excluded from automatic export, via --exclude-libs. Unordered_set<std::string> excluded_libs_; + // List of symbol-names to keep, via -retain-symbol-info. + Unordered_set<std::string> symbols_to_retain_; }; // The position-dependent options. We use this to store the state of |