mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-16 14:45:06 +08:00
Put size and endianness in parameters.
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user