diff options
author | Ian Lance Taylor <iant@google.com> | 2008-02-26 21:45:30 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2008-02-26 21:45:30 +0000 |
commit | 45aa233bdcc27243a2b3e2c699ad0ab59f83901b (patch) | |
tree | 7483af747e28433511eaa64b11233b19473b89c9 | |
parent | 58abc3ebf63249755146ba6a811ad909732641b1 (diff) | |
download | gdb-45aa233bdcc27243a2b3e2c699ad0ab59f83901b.zip gdb-45aa233bdcc27243a2b3e2c699ad0ab59f83901b.tar.gz gdb-45aa233bdcc27243a2b3e2c699ad0ab59f83901b.tar.bz2 |
From Craig Silverstein: rename option functions for future option
handling rewrite.
-rw-r--r-- | gold/archive.cc | 4 | ||||
-rw-r--r-- | gold/compressed_output.cc | 2 | ||||
-rw-r--r-- | gold/fileread.cc | 4 | ||||
-rw-r--r-- | gold/gold.cc | 2 | ||||
-rw-r--r-- | gold/layout.cc | 26 | ||||
-rw-r--r-- | gold/options.cc | 86 | ||||
-rw-r--r-- | gold/options.h | 145 | ||||
-rw-r--r-- | gold/parameters.cc | 8 | ||||
-rw-r--r-- | gold/parameters.h | 6 | ||||
-rw-r--r-- | gold/script.cc | 8 | ||||
-rw-r--r-- | gold/stringpool.cc | 2 | ||||
-rw-r--r-- | gold/symtab.h | 2 |
12 files changed, 150 insertions, 145 deletions
diff --git a/gold/archive.cc b/gold/archive.cc index 2125608..4e15806 100644 --- a/gold/archive.cc +++ b/gold/archive.cc @@ -93,7 +93,7 @@ Archive::setup(Task* task) this->read_armap(sarmag + sizeof(Archive_header), armap_size); off = sarmag + sizeof(Archive_header) + armap_size; } - else if (!this->input_file_->options().include_whole_archive()) + else if (!this->input_file_->options().whole_archive()) gold_error(_("%s: no archive symbol table (run ranlib)"), this->name().c_str()); @@ -265,7 +265,7 @@ void Archive::add_symbols(Symbol_table* symtab, Layout* layout, Input_objects* input_objects) { - if (this->input_file_->options().include_whole_archive()) + if (this->input_file_->options().whole_archive()) return this->include_all_members(symtab, layout, input_objects); const size_t armap_size = this->armap_.size(); diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc index 6904077..0bbcb55 100644 --- a/gold/compressed_output.cc +++ b/gold/compressed_output.cc @@ -49,7 +49,7 @@ zlib_compress(const char* uncompressed_data, unsigned long uncompressed_size, *compressed_data = new char[*compressed_size]; int compress_level; - if (parameters->optimization_level() >= 1) + if (parameters->optimize() >= 1) compress_level = 9; else compress_level = 1; diff --git a/gold/fileread.cc b/gold/fileread.cc index 8e11175..2defbf8 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -643,7 +643,7 @@ Input_file::open(const General_options& options, const Dirsearch& dirpath, n1 += this->input_argument_->name(); std::string n2; if (options.is_static() - || this->input_argument_->options().do_static_search()) + || this->input_argument_->options().Bstatic()) n1 += ".a"; else { @@ -691,7 +691,7 @@ Input_file::open(const General_options& options, const Dirsearch& dirpath, // Now that we've figured out where the file lives, try to open it. General_options::Object_format format = - this->input_argument_->options().input_format(); + this->input_argument_->options().format(); bool ok; if (format == General_options::OBJECT_FORMAT_ELF) ok = this->file_.open(task, name); diff --git a/gold/gold.cc b/gold/gold.cc index eefcb48..e34baeb 100644 --- a/gold/gold.cc +++ b/gold/gold.cc @@ -187,7 +187,7 @@ queue_middle_tasks(const General_options& options, gold_error(_("cannot mix -r with dynamic object %s"), (*input_objects->dynobj_begin())->name().c_str()); if (!doing_static_link - && options.output_format() != General_options::OBJECT_FORMAT_ELF) + && options.oformat() != General_options::OBJECT_FORMAT_ELF) gold_fatal(_("cannot use non-ELF output format with dynamic object %s"), (*input_objects->dynobj_begin())->name().c_str()); diff --git a/gold/layout.cc b/gold/layout.cc index 265dfb2..98cafc5 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -57,7 +57,7 @@ Layout_task_runner::run(Workqueue* workqueue, const Task* task) // Now we know the final size of the output file and we know where // each piece of information goes. Output_file* of = new Output_file(parameters->output_file_name()); - if (this->options_.output_format() != General_options::OBJECT_FORMAT_ELF) + if (this->options_.oformat() != General_options::OBJECT_FORMAT_ELF) of->set_is_temporary(); of->open(file_size); @@ -491,7 +491,7 @@ Layout::layout_eh_frame(Sized_relobj<size, big_endian>* object, this->eh_frame_data_ = new Eh_frame(); os->add_output_section_data(this->eh_frame_data_); - if (this->options_.create_eh_frame_hdr()) + if (this->options_.eh_frame_hdr()) { Output_section* hdr_os = this->choose_output_section(NULL, @@ -636,7 +636,7 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type, { // If -Tbss was specified, we need to separate the data // and BSS segments. - if (this->options_.user_set_bss_segment_address()) + if (this->options_.user_set_Tbss()) { if ((type == elfcpp::SHT_NOBITS) == (*p)->has_any_data_sections()) @@ -959,7 +959,7 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab, else load_seg = this->find_first_load_seg(); - if (this->options_.output_format() != General_options::OBJECT_FORMAT_ELF) + if (this->options_.oformat() != General_options::OBJECT_FORMAT_ELF) load_seg = NULL; gold_assert(phdr_seg == NULL || load_seg != NULL); @@ -1309,8 +1309,8 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg, // Find the PT_LOAD segments, and set their addresses and offsets // and their section's addresses and offsets. uint64_t addr; - if (this->options_.user_set_text_segment_address()) - addr = this->options_.text_segment_address(); + if (this->options_.user_set_Ttext()) + addr = this->options_.Ttext(); else if (parameters->output_is_shared()) addr = 0; else @@ -1350,19 +1350,19 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg, // the physical address. addr = (*p)->paddr(); } - else if (this->options_.user_set_data_segment_address() + else if (this->options_.user_set_Tdata() && ((*p)->flags() & elfcpp::PF_W) != 0 - && (!this->options_.user_set_bss_segment_address() + && (!this->options_.user_set_Tbss() || (*p)->has_any_data_sections())) { - addr = this->options_.data_segment_address(); + addr = this->options_.Tdata(); are_addresses_set = true; } - else if (this->options_.user_set_bss_segment_address() + else if (this->options_.user_set_Tbss() && ((*p)->flags() & elfcpp::PF_W) != 0 && !(*p)->has_any_data_sections()) { - addr = this->options_.bss_segment_address(); + addr = this->options_.Tbss(); are_addresses_set = true; } @@ -2553,7 +2553,7 @@ Layout::write_sections_after_input_sections(Output_file* of) void Layout::write_binary(Output_file* in) const { - gold_assert(this->options_.output_format() + gold_assert(this->options_.oformat() == General_options::OBJECT_FORMAT_BINARY); // Get the size of the binary file. @@ -2724,7 +2724,7 @@ void Close_task_runner::run(Workqueue*, const Task*) { // If we've been asked to create a binary file, we do so here. - if (this->options_->output_format() != General_options::OBJECT_FORMAT_ELF) + if (this->options_->oformat() != General_options::OBJECT_FORMAT_ELF) this->layout_->write_binary(this->of_); this->of_->close(); diff --git a/gold/options.cc b/gold/options.cc index 4d8f0b9..c5f1edf 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -77,16 +77,20 @@ struct options::One_option Command_line*); // If this is a position independent option which does not take an - // argument, this is the member function to call to record it. - void (General_options::*general_noarg)(); + // argument, this is the member function to call to record it. (In + // this file, the bool will always be 'true' to indicate the option + // is set.) + void (General_options::*general_noarg)(bool); // If this is a position independent function which takes an // argument, this is the member function to call to record it. void (General_options::*general_arg)(const char*); // If this is a position dependent option which does not take an - // argument, this is the member function to call to record it. - void (Position_dependent_options::*dependent_noarg)(); + // argument, this is the member function to call to record it. (In + // this file, the bool will always be 'true' to indicate the option + // is set.) + void (Position_dependent_options::*dependent_noarg)(bool); // If this is a position dependent option which takes an argument, // this is the member function to record it. @@ -106,7 +110,7 @@ struct options::One_z_option const char* name; // The member function in General_options called to record it. - void (General_options::*set)(); + void (General_options::*set)(bool); }; // We have a separate table for --debug options. @@ -442,20 +446,20 @@ options::Command_line_options::options[] = NULL, TWO_DASHES, &Position_dependent_options::set_as_needed), POSDEP_NOARG('\0', "no-as-needed", N_("Always DT_NEEDED for dynamic libs (default)"), - NULL, TWO_DASHES, &Position_dependent_options::clear_as_needed), + NULL, TWO_DASHES, &Position_dependent_options::set_no_as_needed), POSDEP_NOARG('\0', "Bdynamic", N_("-l searches for shared libraries"), NULL, ONE_DASH, - &Position_dependent_options::set_dynamic_search), + &Position_dependent_options::set_Bdynamic), POSDEP_NOARG('\0', "Bstatic", N_("-l does not search for shared libraries"), NULL, ONE_DASH, - &Position_dependent_options::set_static_search), + &Position_dependent_options::set_Bstatic), GENERAL_NOARG('\0', "Bsymbolic", N_("Bind defined symbols locally"), - NULL, ONE_DASH, &General_options::set_symbolic), + NULL, ONE_DASH, &General_options::set_Bsymbolic), POSDEP_ARG('b', "format", N_("Set input format (elf, binary)"), N_("-b FORMAT, --format FORMAT"), TWO_DASHES, - &Position_dependent_options::set_input_format), + &Position_dependent_options::set_format), #ifdef HAVE_ZLIB_H # define ZLIB_STR ",zlib" #else @@ -469,12 +473,12 @@ options::Command_line_options::options[] = &General_options::set_compress_debug_sections), GENERAL_ARG('\0', "defsym", N_("Define a symbol"), N_("--defsym SYMBOL=EXPRESSION"), TWO_DASHES, - &General_options::define_symbol), + &General_options::add_to_defsym), GENERAL_NOARG('\0', "demangle", N_("Demangle C++ symbols in log messages"), NULL, TWO_DASHES, &General_options::set_demangle), GENERAL_NOARG('\0', "no-demangle", N_("Do not demangle C++ symbols in log messages"), - NULL, TWO_DASHES, &General_options::clear_demangle), + NULL, TWO_DASHES, &General_options::set_no_demangle), GENERAL_NOARG('\0', "detect-odr-violations", N_("Try to detect violations of the One Definition Rule"), NULL, TWO_DASHES, &General_options::set_detect_odr_violations), @@ -484,7 +488,7 @@ options::Command_line_options::options[] = GENERAL_NOARG('E', "export-dynamic", N_("Export all dynamic symbols"), NULL, TWO_DASHES, &General_options::set_export_dynamic), GENERAL_NOARG('\0', "eh-frame-hdr", N_("Create exception frame header"), - NULL, TWO_DASHES, &General_options::set_create_eh_frame_hdr), + NULL, TWO_DASHES, &General_options::set_eh_frame_hdr), GENERAL_ARG('h', "soname", N_("Set shared library name"), N_("-h FILENAME, -soname FILENAME"), ONE_DASH, &General_options::set_soname), @@ -501,14 +505,14 @@ options::Command_line_options::options[] = &General_options::ignore), GENERAL_ARG('o', "output", N_("Set output file name"), N_("-o FILE, --output FILE"), TWO_DASHES, - &General_options::set_output_file_name), - GENERAL_ARG('O', NULL, N_("Optimize output file size"), + &General_options::set_output), + GENERAL_ARG('O', "optimize", N_("Optimize output file size"), N_("-O level"), ONE_DASH, - &General_options::set_optimization_level), + &General_options::set_optimize), GENERAL_ARG('\0', "oformat", N_("Set output format (only binary supported)"), N_("--oformat FORMAT"), EXACTLY_TWO_DASHES, - &General_options::set_output_format), - GENERAL_NOARG('r', NULL, N_("Generate relocatable output"), NULL, + &General_options::set_oformat), + GENERAL_NOARG('r', "relocatable", N_("Generate relocatable output"), NULL, ONE_DASH, &General_options::set_relocatable), // -R really means -rpath, but can mean --just-symbols for // compatibility with GNU ld. -rpath is always -rpath, so we list @@ -543,13 +547,13 @@ options::Command_line_options::options[] = N_("--sysroot DIR"), TWO_DASHES, &General_options::set_sysroot), GENERAL_ARG('\0', "Tbss", N_("Set the address of the bss segment"), N_("-Tbss ADDRESS"), ONE_DASH, - &General_options::set_bss_segment_address), + &General_options::set_Tbss), GENERAL_ARG('\0', "Tdata", N_("Set the address of the data segment"), N_("-Tdata ADDRESS"), ONE_DASH, - &General_options::set_data_segment_address), + &General_options::set_Tdata), GENERAL_ARG('\0', "Ttext", N_("Set the address of the text segment"), N_("-Ttext ADDRESS"), ONE_DASH, - &General_options::set_text_segment_address), + &General_options::set_Ttext), // This must come after -Ttext and friends since it's a prefix of // them. SPECIAL('T', "script", N_("Read linker script"), @@ -561,7 +565,7 @@ options::Command_line_options::options[] = GENERAL_NOARG('\0', "threads", N_("Run the linker multi-threaded"), NULL, TWO_DASHES, &General_options::set_threads), GENERAL_NOARG('\0', "no-threads", N_("Do not run the linker multi-threaded"), - NULL, TWO_DASHES, &General_options::clear_threads), + NULL, TWO_DASHES, &General_options::set_no_threads), GENERAL_ARG('\0', "thread-count", N_("Number of threads to use"), N_("--thread-count COUNT"), TWO_DASHES, &General_options::set_thread_count), @@ -584,7 +588,7 @@ options::Command_line_options::options[] = POSDEP_NOARG('\0', "no-whole-archive", N_("Include only needed archive contents"), NULL, TWO_DASHES, - &Position_dependent_options::clear_whole_archive), + &Position_dependent_options::set_no_whole_archive), GENERAL_ARG('z', NULL, N_("Subcommands as follows:\n\ @@ -643,8 +647,8 @@ General_options::General_options(Script_options* script_options) search_path_(), optimization_level_(0), output_file_name_("a.out"), - output_format_(OBJECT_FORMAT_ELF), - output_format_string_(NULL), + oformat_(OBJECT_FORMAT_ELF), + oformat_string_(NULL), is_relocatable_(false), strip_(STRIP_NONE), allow_shlib_undefined_(false), @@ -680,7 +684,7 @@ General_options::General_options(Script_options* script_options) // Handle the --defsym option. void -General_options::define_symbol(const char* arg) +General_options::add_to_defsym(const char* arg) { this->script_options_->define_symbol(arg); } @@ -688,10 +692,10 @@ General_options::define_symbol(const char* arg) // Handle the --oformat option. void -General_options::set_output_format(const char* arg) +General_options::set_oformat(const char* arg) { - this->output_format_string_ = arg; - this->output_format_ = string_to_object_format(arg); + this->oformat_string_ = arg; + this->oformat_ = string_to_object_format(arg); } // The x86_64 kernel build converts a binary file to an object file @@ -703,14 +707,14 @@ General_options::set_output_format(const char* arg) Target* General_options::default_target() const { - if (this->output_format_string_ != NULL) + if (this->oformat_string_ != NULL) { - Target* target = select_target_by_name(this->output_format_string_); + Target* target = select_target_by_name(this->oformat_string_); if (target != NULL) return target; gold_error(_("unrecognized output format %s"), - this->output_format_string_); + this->oformat_string_); } // The GOLD_DEFAULT_xx macros are defined by the configure script. @@ -734,7 +738,7 @@ General_options::handle_z_option(const char* arg) { if (strcmp(arg, z_options[i].name) == 0) { - (this->*(z_options[i].set))(); + (this->*(z_options[i].set))(true); return; } } @@ -803,7 +807,7 @@ Position_dependent_options::Position_dependent_options() // Set the input format. void -Position_dependent_options::set_input_format(const char* arg) +Position_dependent_options::set_format(const char* arg) { this->input_format_ = string_to_object_format(arg); } @@ -1108,19 +1112,19 @@ Command_line::get_special_argument(const char* longname, int argc, char** argv, void Command_line::normalize_options() { - if (this->options_.is_shared() && this->options_.is_relocatable()) + if (this->options_.shared() && this->options_.relocatable()) gold_fatal(_("-shared and -r are incompatible")); - if (this->options_.output_format() != General_options::OBJECT_FORMAT_ELF - && (this->options_.is_shared() || this->options_.is_relocatable())) + if (this->options_.oformat() != General_options::OBJECT_FORMAT_ELF + && (this->options_.shared() || this->options_.relocatable())) gold_fatal(_("binary output format not compatible with -shared or -r")); // If the user specifies both -s and -r, convert the -s as -S. // -r requires us to keep externally visible symbols! - if (this->options_.strip_all() && this->options_.is_relocatable()) + if (this->options_.strip_all() && this->options_.relocatable()) { // Clears the strip_all() status, replacing it with strip_debug(). - this->options_.set_strip_debug(); + this->options_.set_strip_debug(true); } // FIXME: we can/should be doing a lot more sanity checking here. @@ -1136,9 +1140,9 @@ Command_line::apply_option(const options::One_option& opt, if (arg == NULL) { if (opt.general_noarg) - (this->options_.*(opt.general_noarg))(); + (this->options_.*(opt.general_noarg))(true); else if (opt.dependent_noarg) - (this->position_options_.*(opt.dependent_noarg))(); + (this->position_options_.*(opt.dependent_noarg))(true); else gold_unreachable(); } diff --git a/gold/options.h b/gold/options.h index ef8e26f..5932560 100644 --- a/gold/options.h +++ b/gold/options.h @@ -150,7 +150,7 @@ class General_options // -O: optimization level (0: don't try to optimize output size). int - optimization_level() const + optimize() const { return this->optimization_level_; } // -o: Output file name. @@ -160,8 +160,8 @@ class General_options // --oformat: Output format. Object_format - output_format() const - { return this->output_format_; } + oformat() const + { return this->oformat_; } // Return the default target. Target* @@ -169,7 +169,7 @@ class General_options // -r: Whether we are doing a relocatable link. bool - is_relocatable() const + relocatable() const { return this->is_relocatable_; } // -s: Strip all symbols. @@ -196,7 +196,7 @@ class General_options // -Bsymbolic: bind defined symbols locally. bool - symbolic() const + Bsymbolic() const { return this->symbolic_; } // --compress-debug-sections: compress .debug_* sections in the @@ -222,7 +222,7 @@ class General_options // --eh-frame-hdr: Whether to generate an exception frame header. bool - create_eh_frame_hdr() const + eh_frame_hdr() const { return this->create_eh_frame_hdr_; } // --rpath: The runtime search path. @@ -237,7 +237,7 @@ class General_options // --shared: Whether generating a shared object. bool - is_shared() const + shared() const { return this->is_shared_; } // --static: Whether doing a static link. @@ -262,32 +262,32 @@ class General_options // -Tbss: The address of the BSS segment uint64_t - bss_segment_address() const + Tbss() const { return this->bss_segment_address_; } // Whether -Tbss was used. bool - user_set_bss_segment_address() const + user_set_Tbss() const { return this->bss_segment_address_ != -1U; } // -Tdata: The address of the data segment uint64_t - data_segment_address() const + Tdata() const { return this->data_segment_address_; } // Whether -Tdata was used. bool - user_set_data_segment_address() const + user_set_Tdata() const { return this->data_segment_address_ != -1U; } // -Ttext: The address of the .text section uint64_t - text_segment_address() const + Ttext() const { return this->text_segment_address_; } // Whether -Ttext was used. bool - user_set_text_segment_address() const + user_set_Ttext() const { return this->text_segment_address_ != -1U; } // --threads: Whether to use threads. @@ -377,8 +377,8 @@ class General_options { this->script_options_->set_entry(arg, strlen(arg)); } void - set_export_dynamic() - { this->export_dynamic_ = true; } + set_export_dynamic(bool value) + { this->export_dynamic_ = value; } void set_soname(const char* arg) @@ -397,7 +397,7 @@ class General_options { this->search_path_.push_back(Search_directory(arg, true)); } void - set_optimization_level(const char* arg) + set_optimize(const char* arg) { char* endptr; this->optimization_level_ = strtol(arg, &endptr, 0); @@ -406,41 +406,41 @@ class General_options } void - set_output_file_name(const char* arg) + set_output(const char* arg) { this->output_file_name_ = arg; } void - set_output_format(const char*); + set_oformat(const char*); void - set_relocatable() - { this->is_relocatable_ = true; } + set_relocatable(bool value) + { this->is_relocatable_ = value; } void - set_strip_all() + set_strip_all(bool) { this->strip_ = STRIP_ALL; } // Note: normalize_options() depends on the fact that this turns off // STRIP_ALL if it were already set. void - set_strip_debug() + set_strip_debug(bool) { this->strip_ = STRIP_DEBUG; } void - set_strip_debug_gdb() + set_strip_debug_gdb(bool) { this->strip_ = STRIP_DEBUG_UNUSED_BY_GDB; } void - set_allow_shlib_undefined() - { this->allow_shlib_undefined_ = true; } + set_allow_shlib_undefined(bool value) + { this->allow_shlib_undefined_ = value; } void - set_no_allow_shlib_undefined() - { this->allow_shlib_undefined_ = false; } + set_no_allow_shlib_undefined(bool value) + { this->set_allow_shlib_undefined(!value); } void - set_symbolic() - { this->symbolic_ = true; } + set_Bsymbolic(bool value) + { this->symbolic_ = value; } void set_compress_debug_sections(const char* arg) { @@ -456,23 +456,23 @@ class General_options } void - define_symbol(const char* arg); + add_to_defsym(const char* arg); void - set_demangle() - { this->demangle_ = true; } + set_demangle(bool value) + { this->demangle_ = value; } void - clear_demangle() - { this->demangle_ = false; } + set_no_demangle(bool value) + { this->set_demangle(!value); } void - set_detect_odr_violations() - { this->detect_odr_violations_ = true; } + set_detect_odr_violations(bool value) + { this->detect_odr_violations_ = value; } void - set_create_eh_frame_hdr() - { this->create_eh_frame_hdr_ = true; } + set_eh_frame_hdr(bool value) + { this->create_eh_frame_hdr_ = value; } void add_to_rpath(const char* arg) @@ -483,16 +483,16 @@ class General_options { this->rpath_link_.push_back(Search_directory(arg, false)); } void - set_shared() - { this->is_shared_ = true; } + set_shared(bool value) + { this->is_shared_ = value; } void - set_static() - { this->is_static_ = true; } + set_static(bool value) + { this->is_static_ = value; } void - set_stats() - { this->print_stats_ = true; } + set_stats(bool value) + { this->print_stats_ = value; } void set_sysroot(const char* arg) @@ -508,15 +508,15 @@ class General_options } void - set_bss_segment_address(const char* arg) + set_Tbss(const char* arg) { this->set_segment_address("-Tbss", arg, &this->bss_segment_address_); } void - set_data_segment_address(const char* arg) + set_Tdata(const char* arg) { this->set_segment_address("-Tdata", arg, &this->data_segment_address_); } void - set_text_segment_address(const char* arg) + set_Ttext(const char* arg) { this->set_segment_address("-Ttext", arg, &this->text_segment_address_); } int @@ -530,17 +530,18 @@ class General_options } void - set_threads() + set_threads(bool value) { #ifndef ENABLE_THREADS - gold_fatal(_("--threads not supported")); + if (value) + gold_fatal(_("--threads not supported")); #endif - this->threads_ = true; + this->threads_ = value; } void - clear_threads() - { this->threads_ = false; } + set_no_threads(bool value) + { this->set_threads(!value); } void set_thread_count(const char* arg) @@ -568,11 +569,11 @@ class General_options { } void - set_execstack() + set_execstack(bool) { this->execstack_ = EXECSTACK_YES; } void - set_noexecstack() + set_noexecstack(bool) { this->execstack_ = EXECSTACK_NO; } void @@ -597,8 +598,8 @@ class General_options Dir_list search_path_; int optimization_level_; const char* output_file_name_; - Object_format output_format_; - const char* output_format_string_; + Object_format oformat_; + const char* oformat_string_; bool is_relocatable_; Strip strip_; bool allow_shlib_undefined_; @@ -639,7 +640,7 @@ class Position_dependent_options // -Bdynamic/-Bstatic: Whether we are searching for a static archive // -rather than a shared object. bool - do_static_search() const + Bstatic() const { return this->do_static_search_; } // --as-needed: Whether to add a DT_NEEDED argument only if the @@ -651,40 +652,40 @@ class Position_dependent_options // --whole-archive: Whether to include the entire contents of an // --archive. bool - include_whole_archive() const + whole_archive() const { return this->include_whole_archive_; } // --format: The format of the input file. Object_format - input_format() const + format() const { return this->input_format_; } void - set_static_search() - { this->do_static_search_ = true; } + set_Bstatic(bool value) + { this->do_static_search_ = value; } void - set_dynamic_search() - { this->do_static_search_ = false; } + set_Bdynamic(bool value) + { this->set_Bstatic(!value); } void - set_as_needed() - { this->as_needed_ = true; } + set_as_needed(bool value) + { this->as_needed_ = value; } void - clear_as_needed() - { this->as_needed_ = false; } + set_no_as_needed(bool value) + { this->set_as_needed(!value); } void - set_whole_archive() - { this->include_whole_archive_ = true; } + set_whole_archive(bool value) + { this->include_whole_archive_ = value; } void - clear_whole_archive() - { this->include_whole_archive_ = false; } + set_no_whole_archive(bool value) + { this->set_whole_archive(!value); } void - set_input_format(const char*); + set_format(const char*); private: bool do_static_search_; diff --git a/gold/parameters.cc b/gold/parameters.cc index e6b9682..5723b80 100644 --- a/gold/parameters.cc +++ b/gold/parameters.cc @@ -51,16 +51,16 @@ Parameters::set_from_options(const General_options* options) this->output_file_name_ = options->output_file_name(); this->sysroot_ = options->sysroot(); this->allow_shlib_undefined_ = options->allow_shlib_undefined(); - this->symbolic_ = options->symbolic(); + this->symbolic_ = options->Bsymbolic(); this->demangle_ = options->demangle(); this->detect_odr_violations_ = options->detect_odr_violations(); - this->optimization_level_ = options->optimization_level(); + this->optimization_level_ = options->optimize(); this->export_dynamic_ = options->export_dynamic(); this->debug_ = options->debug(); - if (options->is_shared()) + if (options->shared()) this->output_file_type_ = OUTPUT_SHARED; - else if (options->is_relocatable()) + else if (options->relocatable()) this->output_file_type_ = OUTPUT_OBJECT; else this->output_file_type_ = OUTPUT_EXECUTABLE; diff --git a/gold/parameters.h b/gold/parameters.h index 67ce1e6..3bf6c50 100644 --- a/gold/parameters.h +++ b/gold/parameters.h @@ -146,7 +146,7 @@ class Parameters // Whether we are doing a symbolic link, in which all defined // symbols are bound locally. bool - symbolic() const + Bsymbolic() const { gold_assert(this->options_valid_); return this->symbolic_; @@ -165,9 +165,9 @@ class Parameters return this->detect_odr_violations_; } - // The general linker optimization level. + // The general linker optimization level (-O). int - optimization_level() const + optimize() const { gold_assert(this->options_valid_); return this->optimization_level_; diff --git a/gold/script.cc b/gold/script.cc index 3213115..faa1cda 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -1419,8 +1419,8 @@ read_script_file(const char* filename, Command_line* cmdline, // We don't want this file to be opened in binary mode. Position_dependent_options posdep = cmdline->position_dependent_options(); - if (posdep.input_format() == General_options::OBJECT_FORMAT_BINARY) - posdep.set_input_format("elf"); + if (posdep.format() == General_options::OBJECT_FORMAT_BINARY) + posdep.set_format("elf"); Input_file_argument input_argument(filename, false, "", false, posdep); Input_file input_file(&input_argument); if (!input_file.open(cmdline->options(), dirsearch, task)) @@ -2094,7 +2094,7 @@ extern "C" void script_start_as_needed(void* closurev) { Parser_closure* closure = static_cast<Parser_closure*>(closurev); - closure->position_dependent_options().set_as_needed(); + closure->position_dependent_options().set_as_needed(true); } // Called by the bison parser at the end of an AS_NEEDED list. @@ -2103,7 +2103,7 @@ extern "C" void script_end_as_needed(void* closurev) { Parser_closure* closure = static_cast<Parser_closure*>(closurev); - closure->position_dependent_options().clear_as_needed(); + closure->position_dependent_options().set_as_needed(false); } // Called by the bison parser to set the entry symbol. diff --git a/gold/stringpool.cc b/gold/stringpool.cc index f569e52..5d13dcf 100644 --- a/gold/stringpool.cc +++ b/gold/stringpool.cc @@ -394,7 +394,7 @@ Stringpool_template<Stringpool_char>::set_string_offsets() // the strtab size, and gives a relatively small benefit (it's // typically rare for a symbol to be a suffix of another), we only // take the time to sort when the user asks for heavy optimization. - if (parameters->optimization_level() < 2) + if (parameters->optimize() < 2) { for (typename String_set_type::iterator curr = this->string_set_.begin(); curr != this->string_set_.end(); diff --git a/gold/symtab.h b/gold/symtab.h index 8da7a78..cdc1ec8 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -471,7 +471,7 @@ class Symbol && this->visibility_ != elfcpp::STV_PROTECTED && !this->is_forced_local_ && parameters->output_is_shared() - && !parameters->symbolic()); + && !parameters->Bsymbolic()); } // Return true if this symbol is a function that needs a PLT entry. |