diff options
author | Ian Lance Taylor <iant@google.com> | 2007-09-26 07:01:35 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-09-26 07:01:35 +0000 |
commit | 9025d29d14ae287d2bc338ef1b0bfa043799e15c (patch) | |
tree | 7802e1942ac6c30223c2bd6b077dc3a64e1d9280 /gold/parameters.cc | |
parent | cc941dee4852b197c1437b2eb28eafb0c9ccaff9 (diff) | |
download | binutils-gdb-9025d29d14ae287d2bc338ef1b0bfa043799e15c.tar.gz |
Put size and endianness in parameters.
Diffstat (limited to 'gold/parameters.cc')
-rw-r--r-- | gold/parameters.cc | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/gold/parameters.cc b/gold/parameters.cc index 462eeea8b9b..db377f83a75 100644 --- a/gold/parameters.cc +++ b/gold/parameters.cc @@ -31,7 +31,8 @@ namespace gold // Initialize the parameters from the options. Parameters::Parameters(const General_options* options) - : optimization_level_(options->optimization_level()) + : is_size_and_endian_valid_(false), size_(0), is_big_endian_(false), + optimization_level_(options->optimization_level()) { if (options->is_shared()) this->output_file_type_ = OUTPUT_SHARED; @@ -41,6 +42,28 @@ Parameters::Parameters(const General_options* options) this->output_file_type_ = OUTPUT_EXECUTABLE; } +// Set the size and endianness. + +void +Parameters::set_size_and_endianness(int size, bool is_big_endian) +{ + if (!this->is_size_and_endian_valid_) + { + this->size_ = size; + this->is_big_endian_ = is_big_endian; + this->is_size_and_endian_valid_ = true; + } + else + { + gold_assert(size == this->size_); + gold_assert(is_big_endian == this->is_big_endian_); + } +} + +// Our local version of the variable, which is not const. + +static Parameters* static_parameters; + // The global variable. const Parameters* parameters; @@ -50,7 +73,13 @@ const Parameters* parameters; void initialize_parameters(const General_options* options) { - parameters = new Parameters(options); + parameters = static_parameters = new Parameters(options); +} + +void +set_parameters_size_and_endianness(int size, bool is_big_endian) +{ + static_parameters->set_size_and_endianness(size, is_big_endian); } } // End namespace gold. |