for reworking option handling.
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
{
// 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);
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());
// 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);
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);
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.
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();
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.
// 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,
// 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"),
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"));
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).
// --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.
// --stats: Print resource usage statistics.
bool
- print_stats() const
+ stats() const
{ return this->print_stats_; }
// --sysroot: The system root of a cross-linker.
// -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.
// --format: The format of the input file.
Object_format
- format() const
+ format_enum() const
{ return this->input_format_; }
void
void
set_format(const char*);
+ void
+ set_format_enum(Object_format value)
+ { this->input_format_ = value; }
+
private:
bool do_static_search_;
bool as_needed_;
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.
// 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))