* options.h (class General_options): Define --wrap as a special

option.  Add wrap_symbols_ field.
	(General_options::any_wrap_symbols): New function.
	(General_options::is_wrap_symbol): New function.
	* options.cc (General_options::parse_wrap): New function.
	(General_options::General_options): Initialize wrap_symbols_.
	* symtab.cc (Symbol_table::wrap_symbol): New function.
	(Symbol_table::add_from_object): Handle --wrap.
	* symtab.h (class Symbol_table): Declare wrap_symbol.
	* target.h (Target::wrap_char): New function.
	(Target::Target_info): Add wrap_char field.
	* i386.cc (Target_i386::i386_info): Initialize wrap_char.
	* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
	* testsuite/testfile.cc (Target_test::test_target_info):
	Likewise.
This commit is contained in:
Ian Lance Taylor
2008-04-09 00:48:13 +00:00
parent 789aa6de31
commit 0864d55193
9 changed files with 127 additions and 1 deletions

View File

@@ -620,6 +620,9 @@ 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_special(start_group, options::TWO_DASHES, '(',
N_("Start a library search group"), NULL);
DEFINE_special(end_group, options::TWO_DASHES, ')',
@@ -702,6 +705,19 @@ 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&);
@@ -745,6 +761,8 @@ 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