aboutsummaryrefslogtreecommitdiff
path: root/gold/parameters.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-27 00:29:34 +0000
committerIan Lance Taylor <iant@google.com>2007-10-27 00:29:34 +0000
commit3c2fafa5311f159f222047699968e091a8f260d6 (patch)
tree48a53667ae73288fab5264e1decc5ab27160d445 /gold/parameters.cc
parent4af13c269b9cd216b8593a2afbcabde5746c720f (diff)
downloadgdb-3c2fafa5311f159f222047699968e091a8f260d6.zip
gdb-3c2fafa5311f159f222047699968e091a8f260d6.tar.gz
gdb-3c2fafa5311f159f222047699968e091a8f260d6.tar.bz2
From Craig Silverstein and Ian Lance Taylor: Process --script option.
Diffstat (limited to 'gold/parameters.cc')
-rw-r--r--gold/parameters.cc39
1 files changed, 31 insertions, 8 deletions
diff --git a/gold/parameters.cc b/gold/parameters.cc
index f8d6039..52deac0 100644
--- a/gold/parameters.cc
+++ b/gold/parameters.cc
@@ -30,14 +30,27 @@ namespace gold
// Initialize the parameters from the options.
-Parameters::Parameters(const General_options* options, Errors* errors)
- : errors_(errors), output_file_name_(options->output_file_name()),
- sysroot_(options->sysroot()), symbolic_(options->symbolic()),
+Parameters::Parameters(Errors* errors)
+ : errors_(errors), output_file_name_(NULL),
+ output_file_type_(OUTPUT_INVALID), sysroot_(),
+ strip_(STRIP_INVALID), symbolic_(false),
+ optimization_level_(0), export_dynamic_(false),
is_doing_static_link_valid_(false), doing_static_link_(false),
- is_size_and_endian_valid_(false), size_(0), is_big_endian_(false),
- optimization_level_(options->optimization_level()),
- export_dynamic_(options->export_dynamic())
+ is_size_and_endian_valid_(false), size_(0), is_big_endian_(false)
{
+}
+
+// Set fields from the command line options.
+
+void
+Parameters::set_from_options(const General_options* options)
+{
+ this->output_file_name_ = options->output_file_name();
+ this->sysroot_ = options->sysroot();
+ this->symbolic_ = options->symbolic();
+ this->optimization_level_ = options->optimization_level();
+ this->export_dynamic_ = options->export_dynamic();
+
if (options->is_shared())
this->output_file_type_ = OUTPUT_SHARED;
else if (options->is_relocatable())
@@ -51,6 +64,8 @@ Parameters::Parameters(const General_options* options, Errors* errors)
this->strip_ = STRIP_DEBUG;
else
this->strip_ = STRIP_NONE;
+
+ this->options_valid_ = true;
}
// Set whether we are doing a static link.
@@ -91,9 +106,17 @@ const Parameters* parameters;
// Initialize the global variable.
void
-initialize_parameters(const General_options* options, Errors* errors)
+initialize_parameters(Errors* errors)
+{
+ parameters = static_parameters = new Parameters(errors);
+}
+
+// Set values from the options.
+
+void
+set_parameters_from_options(const General_options* options)
{
- parameters = static_parameters = new Parameters(options, errors);
+ static_parameters->set_from_options(options);
}
// Set whether we are doing a static link.