aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-03-04 18:21:43 +0000
committerIan Lance Taylor <iant@google.com>2008-03-04 18:21:43 +0000
commit7cc619c3b1e037f50afd7c932d8c5409a6db5cb5 (patch)
tree10c46db6dcc8e2d41e93e851fb95ea06a816ed71
parent95ece4283165eaa6beeb4a3497d12b8726e8bdc8 (diff)
downloadgdb-7cc619c3b1e037f50afd7c932d8c5409a6db5cb5.zip
gdb-7cc619c3b1e037f50afd7c932d8c5409a6db5cb5.tar.gz
gdb-7cc619c3b1e037f50afd7c932d8c5409a6db5cb5.tar.bz2
From Craig Silverstein: rename some option functions in preparation
for reworking option handling.
-rw-r--r--gold/fileread.cc4
-rw-r--r--gold/gold.cc2
-rw-r--r--gold/layout.cc8
-rw-r--r--gold/main.cc6
-rw-r--r--gold/options.cc2
-rw-r--r--gold/options.h18
-rw-r--r--gold/parameters.cc6
-rw-r--r--gold/script.cc4
8 files changed, 27 insertions, 23 deletions
diff --git a/gold/fileread.cc b/gold/fileread.cc
index 901c528..2931d43 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().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);
diff --git a/gold/gold.cc b/gold/gold.cc
index 2ac1a67..daa6596 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.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());
diff --git a/gold/layout.cc b/gold/layout.cc
index 97c13ea..fd7f3af 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -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();
diff --git a/gold/main.cc b/gold/main.cc
index 2fc9439..a5fd12c 100644
--- a/gold/main.cc
+++ b/gold/main.cc
@@ -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"),
diff --git a/gold/options.cc b/gold/options.cc
index 41fa678..88f3db3 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -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"));
diff --git a/gold/options.h b/gold/options.h
index db13929..1b3f396 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -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_;
diff --git a/gold/parameters.cc b/gold/parameters.cc
index db775ed..fdd5fd7 100644
--- a/gold/parameters.cc
+++ b/gold/parameters.cc
@@ -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.
diff --git a/gold/script.cc b/gold/script.cc
index eef034e..2ce14a5 100644
--- a/gold/script.cc
+++ b/gold/script.cc
@@ -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))