aboutsummaryrefslogtreecommitdiff
path: root/gold/options.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-04-17 22:45:47 +0000
committerCary Coutant <ccoutant@google.com>2008-04-17 22:45:47 +0000
commitc5818ff112aac72067c827a4a4fad732eae40741 (patch)
tree7d56ba982473581ec9aab6c40269137cb4a9ea35 /gold/options.h
parente9bbd7c5e43873cff4050cad26808f727294f7cc (diff)
downloadfsf-binutils-gdb-c5818ff112aac72067c827a4a4fad732eae40741.zip
fsf-binutils-gdb-c5818ff112aac72067c827a4a4fad732eae40741.tar.gz
fsf-binutils-gdb-c5818ff112aac72067c827a4a4fad732eae40741.tar.bz2
* errors.cc (Errors::info): New function.
(gold_info): New function. * errors.h (Errors::info): New function. * gold.h (gold_info): New function. * object.cc (Input_objects::add_object): Print trace output. * options.cc (options::parse_set): New function. (General_options::parse_wrap): Deleted. (General_options::General_options): Deleted initializer. * options.h (options::String_set): New typedef. (options::parse_set): New function. (DEFINE_set): New macro. (General_options::wrap): Changed to use DEFINE_set. Changed callers of any_wrap_symbols and is_wrap_symbol. (General_options::trace, General_options::trace_symbol): New options. (General_options::any_wrap_symbols, General_options::is_wrap_symbol) (General_options::wrap_symbols_): Deleted. * symtab.cc (Symbol_table::add_from_object): Print trace output.
Diffstat (limited to 'gold/options.h')
-rw-r--r--gold/options.h47
1 files changed, 30 insertions, 17 deletions
diff --git a/gold/options.h b/gold/options.h
index 100e53b..419e70b 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -61,6 +61,7 @@ class Target;
namespace options
{
typedef std::vector<Search_directory> Dir_list;
+typedef Unordered_set<std::string> String_set;
// These routines convert from a string option to various types.
// Each gives a fatal error if it cannot parse the argument.
@@ -88,6 +89,9 @@ extern void
parse_dirlist(const char* option_name, const char* arg, Dir_list* retval);
extern void
+parse_set(const char* option_name, const char* arg, String_set* retval);
+
+extern void
parse_choices(const char* option_name, const char* arg, const char** retval,
const char* choices[], int num_choices);
@@ -347,6 +351,24 @@ struct Struct_special : public Struct_var
add_search_directory_to_##varname__(const Search_directory& dir) \
{ this->varname__##_.value.push_back(dir); }
+// This is like DEFINE_string, but we store a set of strings.
+#define DEFINE_set(varname__, dashes__, shortname__, \
+ helpstring__, helparg__) \
+ DEFINE_var(varname__, dashes__, shortname__, , \
+ "", helpstring__, helparg__, false, options::String_set, \
+ const options::String_set&, options::parse_set) \
+ public: \
+ bool \
+ any_##varname__() const \
+ { return !this->varname__##_.value.empty(); } \
+ bool \
+ is_##varname__(const char* symbol) const \
+ { \
+ return (!this->varname__##_.value.empty() \
+ && (this->varname__##_.value.find(std::string(symbol)) \
+ != this->varname__##_.value.end())); \
+ }
+
// When you have a list of possible values (expressed as string)
// After helparg__ should come an initializer list, like
// {"foo", "bar", "baz"}
@@ -625,6 +647,9 @@ class General_options
DEFINE_string(sysroot, options::TWO_DASHES, '\0', "",
N_("Set target system root directory"), N_("DIR"));
+ DEFINE_bool(trace, options::TWO_DASHES, 't', false,
+ N_("Print the name of each input file"), NULL);
+
DEFINE_special(script, options::TWO_DASHES, 'T',
N_("Read linker script"), N_("FILE"));
@@ -657,8 +682,11 @@ class General_options
N_("Include all archive contents"),
N_("Include only needed archive contents"));
- DEFINE_special(wrap, options::TWO_DASHES, '\0',
- N_("Use wrapper functions for SYMBOL"), N_("SYMBOL"));
+ DEFINE_set(wrap, options::TWO_DASHES, '\0',
+ N_("Use wrapper functions for SYMBOL"), N_("SYMBOL"));
+
+ DEFINE_set(trace_symbol, options::TWO_DASHES, 'y',
+ N_("Trace references to symbol"), N_("SYMBOL"));
DEFINE_string(Y, options::EXACTLY_ONE_DASH, 'Y', "",
N_("Default search path for Solaris compatibility"),
@@ -767,19 +795,6 @@ class General_options
do_demangle() const
{ return this->do_demangle_; }
- // Whether there are any symbols to wrap.
- bool
- any_wrap_symbols() const
- { return !this->wrap_symbols_.empty(); }
-
- // Whether to wrap SYMBOL.
- bool
- is_wrap_symbol(const char* symbol) const
- {
- return (this->wrap_symbols_.find(std::string(symbol))
- != this->wrap_symbols_.end());
- }
-
private:
// Don't copy this structure.
General_options(const General_options&);
@@ -823,8 +838,6 @@ class General_options
bool static_;
// Whether to do demangling.
bool do_demangle_;
- // List of symbols used with --wrap.
- Unordered_set<std::string> wrap_symbols_;
};
// The position-dependent options. We use this to store the state of