From f3e9c5c5170afd576cb1c31464472587aba05f52 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 7 May 2008 06:08:01 +0000 Subject: PR 6049 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end functions. (class General_options): Remove existing --undefined, and add --no-undefined instead. Add new --undefined as synonym for -u. * archive.cc (Archive::add_symbols): Check whether symbol was named with -u. * gold.cc (queue_middle_tasks): Add -u symbols to symbol table. * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change all uses. Add IS_UNDEFINED. Update declarations to split different versions of init_base. Declare init_base_undefined. (Symbol::is_defined): Handle IS_UNDEFINED. (Symbol::is_undefined): Likewise. (Symbol::is_weak_undefined): Call is_undefined. (Symbol::is_absolute): Handle IS_CONSTANT. (class Sized_symbol): Update declarations to split different versions of init. Declare init_undefined. (class Symbol_table): Declare new functions. * symtab.cc (Symbol::init_base_object): Rename from init_base. Change all callers. (Symbol::init_base_output_data): Likewise. (Symbol::init_base_output_segment): Likewise. (Symbol::init_base_constant): Likewise. (Symbol::init_base_undefined): New function. (Sized_symbol::init_object): Rename from init. Change all callers. (Sized_symbol::init_output_data): Likewise. (Sized_symbol::init_output_segment): Likewise. (Sized_symbol::init_constant): Likewise. (Sized_symbol::init_undefined): New function. (Symbol_table::add_undefined_symbols_from_command_line): New function. (Symbol_table::do_add_undefined_symbols_from_command_line): New function. (Symbol::final_value_is_known): Handle IS_UNDEFINED. (Symbol::output_section): Likewise. (Symbol::set_output_section): Likewise. (Symbol_table::sized_finalize_symbol): Likewise. (Symbol_table::sized_write_globals): Likewise. * resolve.cc (Symbol_table::should_override): Likewise. (Symbol::override_base_with_special): Likewise. --- gold/options.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'gold/options.h') diff --git a/gold/options.h b/gold/options.h index cf9b887..bfb40c7 100644 --- a/gold/options.h +++ b/gold/options.h @@ -369,13 +369,22 @@ struct Struct_special : public Struct_var 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())); \ - } + } \ + \ + options::String_set::const_iterator \ + varname__##_begin() const \ + { return this->varname__##_.value.begin(); } \ + \ + options::String_set::const_iterator \ + varname__##_end() const \ + { return this->varname__##_.value.end(); } // When you have a list of possible values (expressed as string) // After helparg__ should come an initializer list, like @@ -652,6 +661,10 @@ class General_options DEFINE_bool(noinhibit_exec, options::TWO_DASHES, '\0', false, N_("Create an output file even if errors occur"), NULL); + DEFINE_bool_alias(no_undefined, defs, options::TWO_DASHES, '\0', + N_("Report undefined symbols (even with --shared)"), + NULL, false); + DEFINE_string(output, options::TWO_DASHES, 'o', "a.out", N_("Set output file name"), N_("FILE")); @@ -733,10 +746,8 @@ class General_options DEFINE_uint64(Ttext, options::ONE_DASH, '\0', -1U, N_("Set the address of the text segment"), N_("ADDRESS")); - DEFINE_bool_alias(undefined, defs, options::TWO_DASHES, '\0', - "Allow undefined symbols with --shared", - "Report undefined symbols (even with --shared)", - true); + DEFINE_set(undefined, options::TWO_DASHES, 'u', + N_("Create undefined reference to SYMBOL"), N_("SYMBOL")); DEFINE_bool(verbose, options::TWO_DASHES, '\0', false, N_("Synonym for --debug=files"), NULL); -- cgit v1.1