From Craig Silverstein: rename some option functions in preparation
for reworking option handling.
This commit is contained in:
parent
95ece42831
commit
7cc619c3b1
|
@ -643,7 +643,7 @@ Input_file::open(const General_options& options, const Dirsearch& dirpath,
|
||||||
n1 += this->input_argument_->name();
|
n1 += this->input_argument_->name();
|
||||||
std::string n2;
|
std::string n2;
|
||||||
if (options.is_static()
|
if (options.is_static()
|
||||||
|| this->input_argument_->options().Bstatic())
|
|| !this->input_argument_->options().Bdynamic())
|
||||||
n1 += ".a";
|
n1 += ".a";
|
||||||
else
|
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.
|
// Now that we've figured out where the file lives, try to open it.
|
||||||
|
|
||||||
General_options::Object_format format =
|
General_options::Object_format format =
|
||||||
this->input_argument_->options().format();
|
this->input_argument_->options().format_enum();
|
||||||
bool ok;
|
bool ok;
|
||||||
if (format == General_options::OBJECT_FORMAT_ELF)
|
if (format == General_options::OBJECT_FORMAT_ELF)
|
||||||
ok = this->file_.open(task, name);
|
ok = this->file_.open(task, name);
|
||||||
|
|
|
@ -187,7 +187,7 @@ queue_middle_tasks(const General_options& options,
|
||||||
gold_error(_("cannot mix -r with dynamic object %s"),
|
gold_error(_("cannot mix -r with dynamic object %s"),
|
||||||
(*input_objects->dynobj_begin())->name().c_str());
|
(*input_objects->dynobj_begin())->name().c_str());
|
||||||
if (!doing_static_link
|
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"),
|
gold_fatal(_("cannot use non-ELF output format with dynamic object %s"),
|
||||||
(*input_objects->dynobj_begin())->name().c_str());
|
(*input_objects->dynobj_begin())->name().c_str());
|
||||||
|
|
||||||
|
|
|
@ -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
|
// Now we know the final size of the output file and we know where
|
||||||
// each piece of information goes.
|
// each piece of information goes.
|
||||||
Output_file* of = new Output_file(parameters->options().output_file_name());
|
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->set_is_temporary();
|
||||||
of->open(file_size);
|
of->open(file_size);
|
||||||
|
|
||||||
|
@ -987,7 +987,7 @@ Layout::finalize(const Input_objects* input_objects, Symbol_table* symtab,
|
||||||
else
|
else
|
||||||
load_seg = this->find_first_load_seg();
|
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;
|
load_seg = NULL;
|
||||||
|
|
||||||
gold_assert(phdr_seg == NULL || 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
|
void
|
||||||
Layout::write_binary(Output_file* in) const
|
Layout::write_binary(Output_file* in) const
|
||||||
{
|
{
|
||||||
gold_assert(this->options_.oformat()
|
gold_assert(this->options_.oformat_enum()
|
||||||
== General_options::OBJECT_FORMAT_BINARY);
|
== General_options::OBJECT_FORMAT_BINARY);
|
||||||
|
|
||||||
// Get the size of the binary file.
|
// Get the size of the binary file.
|
||||||
|
@ -2732,7 +2732,7 @@ void
|
||||||
Close_task_runner::run(Workqueue*, const Task*)
|
Close_task_runner::run(Workqueue*, const Task*)
|
||||||
{
|
{
|
||||||
// If we've been asked to create a binary file, we do so here.
|
// 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->layout_->write_binary(this->of_);
|
||||||
|
|
||||||
this->of_->close();
|
this->of_->close();
|
||||||
|
|
|
@ -152,7 +152,7 @@ main(int argc, char** argv)
|
||||||
command_line.process(argc - 1, argv + 1);
|
command_line.process(argc - 1, argv + 1);
|
||||||
|
|
||||||
long start_time = 0;
|
long start_time = 0;
|
||||||
if (command_line.options().print_stats())
|
if (command_line.options().stats())
|
||||||
start_time = get_run_time();
|
start_time = get_run_time();
|
||||||
|
|
||||||
// Store some options in the globally accessible parameters.
|
// 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.
|
// Get the search path from the -L options.
|
||||||
Dirsearch search_path;
|
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 up the first set of tasks.
|
||||||
queue_initial_tasks(command_line.options(), search_path,
|
queue_initial_tasks(command_line.options(), search_path,
|
||||||
|
@ -200,7 +200,7 @@ main(int argc, char** argv)
|
||||||
// Run the main task processing loop.
|
// Run the main task processing loop.
|
||||||
workqueue.process(0);
|
workqueue.process(0);
|
||||||
|
|
||||||
if (command_line.options().print_stats())
|
if (command_line.options().stats())
|
||||||
{
|
{
|
||||||
long run_time = get_run_time() - start_time;
|
long run_time = get_run_time() - start_time;
|
||||||
fprintf(stderr, _("%s: total run time: %ld.%06ld seconds\n"),
|
fprintf(stderr, _("%s: total run time: %ld.%06ld seconds\n"),
|
||||||
|
|
|
@ -1136,7 +1136,7 @@ Command_line::normalize_options()
|
||||||
if (this->options_.shared() && this->options_.relocatable())
|
if (this->options_.shared() && this->options_.relocatable())
|
||||||
gold_fatal(_("-shared and -r are incompatible"));
|
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()))
|
&& (this->options_.shared() || this->options_.relocatable()))
|
||||||
gold_fatal(_("binary output format not compatible with -shared or -r"));
|
gold_fatal(_("binary output format not compatible with -shared or -r"));
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ class General_options
|
||||||
typedef std::vector<Search_directory> Dir_list;
|
typedef std::vector<Search_directory> Dir_list;
|
||||||
|
|
||||||
const Dir_list&
|
const Dir_list&
|
||||||
search_path() const
|
library_path() const
|
||||||
{ return this->search_path_; }
|
{ return this->search_path_; }
|
||||||
|
|
||||||
// -O: optimization level (0: don't try to optimize output size).
|
// -O: optimization level (0: don't try to optimize output size).
|
||||||
|
@ -165,11 +165,11 @@ class General_options
|
||||||
|
|
||||||
// --oformat: Output format.
|
// --oformat: Output format.
|
||||||
Object_format
|
Object_format
|
||||||
oformat() const
|
oformat_enum() const
|
||||||
{ return this->oformat_; }
|
{ return this->oformat_; }
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
oformat_string() const
|
oformat() const
|
||||||
{ return this->oformat_string_; }
|
{ return this->oformat_string_; }
|
||||||
|
|
||||||
// Return the default target.
|
// Return the default target.
|
||||||
|
@ -267,7 +267,7 @@ class General_options
|
||||||
|
|
||||||
// --stats: Print resource usage statistics.
|
// --stats: Print resource usage statistics.
|
||||||
bool
|
bool
|
||||||
print_stats() const
|
stats() const
|
||||||
{ return this->print_stats_; }
|
{ return this->print_stats_; }
|
||||||
|
|
||||||
// --sysroot: The system root of a cross-linker.
|
// --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
|
// -Bdynamic/-Bstatic: Whether we are searching for a static archive
|
||||||
// -rather than a shared object.
|
// -rather than a shared object.
|
||||||
bool
|
bool
|
||||||
Bstatic() const
|
Bdynamic() const
|
||||||
{ return this->do_static_search_; }
|
{ return !this->do_static_search_; }
|
||||||
|
|
||||||
// --as-needed: Whether to add a DT_NEEDED argument only if the
|
// --as-needed: Whether to add a DT_NEEDED argument only if the
|
||||||
// dynamic object is used.
|
// dynamic object is used.
|
||||||
|
@ -713,7 +713,7 @@ class Position_dependent_options
|
||||||
|
|
||||||
// --format: The format of the input file.
|
// --format: The format of the input file.
|
||||||
Object_format
|
Object_format
|
||||||
format() const
|
format_enum() const
|
||||||
{ return this->input_format_; }
|
{ return this->input_format_; }
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -743,6 +743,10 @@ class Position_dependent_options
|
||||||
void
|
void
|
||||||
set_format(const char*);
|
set_format(const char*);
|
||||||
|
|
||||||
|
void
|
||||||
|
set_format_enum(Object_format value)
|
||||||
|
{ this->input_format_ = value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool do_static_search_;
|
bool do_static_search_;
|
||||||
bool as_needed_;
|
bool as_needed_;
|
||||||
|
|
|
@ -72,15 +72,15 @@ const Target&
|
||||||
Parameters::default_target() const
|
Parameters::default_target() const
|
||||||
{
|
{
|
||||||
gold_assert(this->options_valid());
|
gold_assert(this->options_valid());
|
||||||
if (this->options().oformat_string() != NULL)
|
if (this->options().oformat() != NULL)
|
||||||
{
|
{
|
||||||
const Target* target
|
const Target* target
|
||||||
= select_target_by_name(this->options().oformat_string());
|
= select_target_by_name(this->options().oformat());
|
||||||
if (target != NULL)
|
if (target != NULL)
|
||||||
return *target;
|
return *target;
|
||||||
|
|
||||||
gold_error(_("unrecognized output format %s"),
|
gold_error(_("unrecognized output format %s"),
|
||||||
this->options().oformat_string());
|
this->options().oformat());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The GOLD_DEFAULT_xx macros are defined by the configure script.
|
// The GOLD_DEFAULT_xx macros are defined by the configure script.
|
||||||
|
|
|
@ -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.
|
// We don't want this file to be opened in binary mode.
|
||||||
Position_dependent_options posdep = cmdline->position_dependent_options();
|
Position_dependent_options posdep = cmdline->position_dependent_options();
|
||||||
if (posdep.format() == General_options::OBJECT_FORMAT_BINARY)
|
if (posdep.format_enum() == General_options::OBJECT_FORMAT_BINARY)
|
||||||
posdep.set_format("elf");
|
posdep.set_format_enum(General_options::OBJECT_FORMAT_ELF);
|
||||||
Input_file_argument input_argument(filename, false, "", false, posdep);
|
Input_file_argument input_argument(filename, false, "", false, posdep);
|
||||||
Input_file input_file(&input_argument);
|
Input_file input_file(&input_argument);
|
||||||
if (!input_file.open(cmdline->options(), dirsearch, task))
|
if (!input_file.open(cmdline->options(), dirsearch, task))
|
||||||
|
|
Loading…
Reference in New Issue