From Craig Silverstein: rename some option functions in preparation
authorIan Lance Taylor <iant@google.com>
Tue, 4 Mar 2008 18:21:43 +0000 (18:21 +0000)
committerIan Lance Taylor <iant@google.com>
Tue, 4 Mar 2008 18:21:43 +0000 (18:21 +0000)
for reworking option handling.

gold/fileread.cc
gold/gold.cc
gold/layout.cc
gold/main.cc
gold/options.cc
gold/options.h
gold/parameters.cc
gold/script.cc

index 901c528..2931d43 100644 (file)
@@ -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().Bstatic())
+         || !this->input_argument_->options().Bdynamic())
        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().format();
+    this->input_argument_->options().format_enum();
   bool ok;
   if (format == General_options::OBJECT_FORMAT_ELF)
     ok = this->file_.open(task, name);
index 2ac1a67..daa6596 100644 (file)
@@ -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.oformat() != General_options::OBJECT_FORMAT_ELF)
+      && options.oformat_enum() != General_options::OBJECT_FORMAT_ELF)
     gold_fatal(_("cannot use non-ELF output format with dynamic object %s"),
               (*input_objects->dynobj_begin())->name().c_str());
 
index 97c13ea..fd7f3af 100644 (file)
@@ -58,7 +58,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->options().output_file_name());
-  if (this->options_.oformat() != General_options::OBJECT_FORMAT_ELF)
+  if (this->options_.oformat_enum() != General_options::OBJECT_FORMAT_ELF)
     of->set_is_temporary();
   of->open(file_size);
 
@@ -987,7 +987,7 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
   else
     load_seg = this->find_first_load_seg();
 
-  if (this->options_.oformat() != General_options::OBJECT_FORMAT_ELF)
+  if (this->options_.oformat_enum() != General_options::OBJECT_FORMAT_ELF)
     load_seg = NULL;
 
   gold_assert(phdr_seg == NULL || load_seg != NULL);
@@ -2561,7 +2561,7 @@ Layout::write_sections_after_input_sections(Output_file* of)
 void
 Layout::write_binary(Output_file* in) const
 {
-  gold_assert(this->options_.oformat()
+  gold_assert(this->options_.oformat_enum()
              == General_options::OBJECT_FORMAT_BINARY);
 
   // Get the size of the binary file.
@@ -2732,7 +2732,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_->oformat() != General_options::OBJECT_FORMAT_ELF)
+  if (this->options_->oformat_enum() != General_options::OBJECT_FORMAT_ELF)
     this->layout_->write_binary(this->of_);
 
   this->of_->close();
index 2fc9439..a5fd12c 100644 (file)
@@ -152,7 +152,7 @@ main(int argc, char** argv)
   command_line.process(argc - 1, argv + 1);
 
   long start_time = 0;
-  if (command_line.options().print_stats())
+  if (command_line.options().stats())
     start_time = get_run_time();
 
   // Store some options in the globally accessible parameters.
@@ -190,7 +190,7 @@ main(int argc, char** argv)
 
   // Get the search path from the -L options.
   Dirsearch search_path;
-  search_path.initialize(&workqueue, &command_line.options().search_path());
+  search_path.initialize(&workqueue, &command_line.options().library_path());
 
   // Queue up the first set of tasks.
   queue_initial_tasks(command_line.options(), search_path,
@@ -200,7 +200,7 @@ main(int argc, char** argv)
   // Run the main task processing loop.
   workqueue.process(0);
 
-  if (command_line.options().print_stats())
+  if (command_line.options().stats())
     {
       long run_time = get_run_time() - start_time;
       fprintf(stderr, _("%s: total run time: %ld.%06ld seconds\n"),
index 41fa678..88f3db3 100644 (file)
@@ -1136,7 +1136,7 @@ Command_line::normalize_options()
   if (this->options_.shared() && this->options_.relocatable())
     gold_fatal(_("-shared and -r are incompatible"));
 
-  if (this->options_.oformat() != General_options::OBJECT_FORMAT_ELF
+  if (this->options_.oformat_enum() != General_options::OBJECT_FORMAT_ELF
       && (this->options_.shared() || this->options_.relocatable()))
     gold_fatal(_("binary output format not compatible with -shared or -r"));
 
index db13929..1b3f396 100644 (file)
@@ -150,7 +150,7 @@ class General_options
   typedef std::vector<Search_directory> Dir_list;
 
   const Dir_list&
-  search_path() const
+  library_path() const
   { return this->search_path_; }
 
   // -O: optimization level (0: don't try to optimize output size).
@@ -165,11 +165,11 @@ class General_options
 
   // --oformat: Output format.
   Object_format
-  oformat() const
+  oformat_enum() const
   { return this->oformat_; }
 
   const char*
-  oformat_string() const
+  oformat() const
   { return this->oformat_string_; }
 
   // Return the default target.
@@ -267,7 +267,7 @@ class General_options
 
   // --stats: Print resource usage statistics.
   bool
-  print_stats() const
+  stats() const
   { return this->print_stats_; }
 
   // --sysroot: The system root of a cross-linker.
@@ -696,8 +696,8 @@ class Position_dependent_options
   // -Bdynamic/-Bstatic: Whether we are searching for a static archive
   // -rather than a shared object.
   bool
-  Bstatic() const
-  { return this->do_static_search_; }
+  Bdynamic() const
+  { return !this->do_static_search_; }
 
   // --as-needed: Whether to add a DT_NEEDED argument only if the
   // dynamic object is used.
@@ -713,7 +713,7 @@ class Position_dependent_options
 
   // --format: The format of the input file.
   Object_format
-  format() const
+  format_enum() const
   { return this->input_format_; }
 
   void
@@ -743,6 +743,10 @@ class Position_dependent_options
   void
   set_format(const char*);
 
+  void
+  set_format_enum(Object_format value)
+  { this->input_format_ = value; }
+
  private:
   bool do_static_search_;
   bool as_needed_;
index db775ed..fdd5fd7 100644 (file)
@@ -72,15 +72,15 @@ const Target&
 Parameters::default_target() const
 {
   gold_assert(this->options_valid());
-  if (this->options().oformat_string() != NULL)
+  if (this->options().oformat() != NULL)
     {
       const Target* target
-          = select_target_by_name(this->options().oformat_string());
+          = select_target_by_name(this->options().oformat());
       if (target != NULL)
        return *target;
 
       gold_error(_("unrecognized output format %s"),
-                this->options().oformat_string());
+                 this->options().oformat());
     }
 
   // The GOLD_DEFAULT_xx macros are defined by the configure script.
index eef034e..2ce14a5 100644 (file)
@@ -1381,8 +1381,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.format() == General_options::OBJECT_FORMAT_BINARY)
-    posdep.set_format("elf");
+  if (posdep.format_enum() == General_options::OBJECT_FORMAT_BINARY)
+    posdep.set_format_enum(General_options::OBJECT_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))