// options.h -- handle command line options for gold -*- C++ -*-
-// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
class General_options
{
public:
- General_options();
+ General_options(Script_options*);
+
+ // -e: set entry address.
+ const char*
+ entry() const
+ { return this->script_options_->entry(); }
// -E: export dynamic symbols.
bool
export_dynamic() const
{ return this->export_dynamic_; }
+ // -h: shared library name.
+ const char*
+ soname() const
+ { return this->soname_; }
+
// -I: dynamic linker name.
const char*
dynamic_linker() const
sysroot() const
{ return this->sysroot_; }
+ // --version-script: The version script to apply if --shared is true.
+ const Version_script_info&
+ version_script() const
+ { return *this->script_options_->version_script_info(); }
+
// -Ttext: The address of the .text section
uint64_t
text_segment_address() const
debug() const
{ return this->debug_; }
+ // Return the options which may be set from a linker script.
+ Script_options*
+ script_options()
+ { return this->script_options_; }
+
+ const Script_options*
+ script_options() const
+ { return this->script_options_; }
+
private:
// Don't copy this structure.
General_options(const General_options&);
};
void
+ set_entry(const char* arg)
+ { this->script_options_->set_entry(arg, strlen(arg)); }
+
+ void
set_export_dynamic()
{ this->export_dynamic_ = true; }
void
+ set_soname(const char* arg)
+ { this->soname_ = arg; }
+
+ void
set_dynamic_linker(const char* arg)
{ this->dynamic_linker_ = arg; }
}
void
+ define_symbol(const char* arg);
+
+ void
set_demangle()
{ this->demangle_ = true; }
add_sysroot();
bool export_dynamic_;
+ const char* soname_;
const char* dynamic_linker_;
Dir_list search_path_;
int optimization_level_;
int thread_count_final_;
Execstack execstack_;
unsigned int debug_;
+ // Some options can also be set from linker scripts. Those are
+ // stored here.
+ Script_options* script_options_;
};
// The current state of the position dependent options.
public:
typedef Input_arguments::const_iterator const_iterator;
- Command_line();
+ Command_line(Script_options*);
// Process the command line options. This will exit with an
// appropriate error message if an unrecognized option is seen.
position_dependent_options() const
{ return this->position_options_; }
+ // Get the options which may be set from a linker script.
+ Script_options*
+ script_options()
+ { return this->options_.script_options(); }
+
+ const Script_options*
+ script_options() const
+ { return this->options_.script_options(); }
+
// The number of input files.
int
number_of_input_files() const