Line 75... |
Line 75... |
uint64_t
|
uint64_t
|
Expression::eval(const Symbol_table* symtab, const Layout* layout,
|
Expression::eval(const Symbol_table* symtab, const Layout* layout,
|
bool check_assertions)
|
bool check_assertions)
|
{
|
{
|
return this->eval_maybe_dot(symtab, layout, check_assertions,
|
return this->eval_maybe_dot(symtab, layout, check_assertions,
|
false, 0, NULL, NULL, NULL);
|
false, 0, NULL, NULL, NULL, false);
|
}
|
}
|
|
|
// Evaluate an expression which may refer to the dot symbol.
|
// Evaluate an expression which may refer to the dot symbol.
|
|
|
uint64_t
|
uint64_t
|
Expression::eval_with_dot(const Symbol_table* symtab, const Layout* layout,
|
Expression::eval_with_dot(const Symbol_table* symtab, const Layout* layout,
|
bool check_assertions, uint64_t dot_value,
|
bool check_assertions, uint64_t dot_value,
|
Output_section* dot_section,
|
Output_section* dot_section,
|
Output_section** result_section_pointer,
|
Output_section** result_section_pointer,
|
uint64_t* result_alignment_pointer)
|
uint64_t* result_alignment_pointer,
|
|
bool is_section_dot_assignment)
|
{
|
{
|
return this->eval_maybe_dot(symtab, layout, check_assertions, true,
|
return this->eval_maybe_dot(symtab, layout, check_assertions, true,
|
dot_value, dot_section, result_section_pointer,
|
dot_value, dot_section, result_section_pointer,
|
result_alignment_pointer);
|
result_alignment_pointer,
|
|
is_section_dot_assignment);
|
}
|
}
|
|
|
// Evaluate an expression which may or may not refer to the dot
|
// Evaluate an expression which may or may not refer to the dot
|
// symbol.
|
// symbol.
|
|
|
uint64_t
|
uint64_t
|
Expression::eval_maybe_dot(const Symbol_table* symtab, const Layout* layout,
|
Expression::eval_maybe_dot(const Symbol_table* symtab, const Layout* layout,
|
bool check_assertions, bool is_dot_available,
|
bool check_assertions, bool is_dot_available,
|
uint64_t dot_value, Output_section* dot_section,
|
uint64_t dot_value, Output_section* dot_section,
|
Output_section** result_section_pointer,
|
Output_section** result_section_pointer,
|
uint64_t* result_alignment_pointer)
|
uint64_t* result_alignment_pointer,
|
|
bool is_section_dot_assignment)
|
{
|
{
|
Expression_eval_info eei;
|
Expression_eval_info eei;
|
eei.symtab = symtab;
|
eei.symtab = symtab;
|
eei.layout = layout;
|
eei.layout = layout;
|
eei.check_assertions = check_assertions;
|
eei.check_assertions = check_assertions;
|
eei.is_dot_available = is_dot_available;
|
eei.is_dot_available = is_dot_available;
|
eei.dot_value = dot_value;
|
eei.dot_value = dot_value;
|
eei.dot_section = dot_section;
|
eei.dot_section = dot_section;
|
|
|
// We assume the value is absolute, and only set this to a section
|
// We assume the value is absolute, and only set this to a section
|
// if we find a section relative reference.
|
// if we find a section-relative reference.
|
if (result_section_pointer != NULL)
|
if (result_section_pointer != NULL)
|
*result_section_pointer = NULL;
|
*result_section_pointer = NULL;
|
eei.result_section_pointer = result_section_pointer;
|
eei.result_section_pointer = result_section_pointer;
|
|
|
eei.result_alignment_pointer = result_alignment_pointer;
|
eei.result_alignment_pointer = result_alignment_pointer;
|
|
|
return this->value(&eei);
|
uint64_t val = this->value(&eei);
|
|
|
|
// If this is an assignment to dot within a section, and the value
|
|
// is absolute, treat it as a section-relative offset.
|
|
if (is_section_dot_assignment && *result_section_pointer == NULL)
|
|
{
|
|
gold_assert(dot_section != NULL);
|
|
val += dot_section->address();
|
|
*result_section_pointer = dot_section;
|
|
}
|
|
return val;
|
}
|
}
|
|
|
// A number.
|
// A number.
|
|
|
class Integer_expression : public Expression
|
class Integer_expression : public Expression
|
Line 255... |
Line 268... |
eei->check_assertions,
|
eei->check_assertions,
|
eei->is_dot_available,
|
eei->is_dot_available,
|
eei->dot_value,
|
eei->dot_value,
|
eei->dot_section,
|
eei->dot_section,
|
arg_section_pointer,
|
arg_section_pointer,
|
eei->result_alignment_pointer);
|
eei->result_alignment_pointer,
|
|
false);
|
}
|
}
|
|
|
void
|
void
|
arg_print(FILE* f) const
|
arg_print(FILE* f) const
|
{ this->arg_->print(f); }
|
{ this->arg_->print(f); }
|
Line 334... |
Line 348... |
eei->check_assertions,
|
eei->check_assertions,
|
eei->is_dot_available,
|
eei->is_dot_available,
|
eei->dot_value,
|
eei->dot_value,
|
eei->dot_section,
|
eei->dot_section,
|
section_pointer,
|
section_pointer,
|
alignment_pointer);
|
alignment_pointer,
|
|
false);
|
}
|
}
|
|
|
uint64_t
|
uint64_t
|
right_value(const Expression_eval_info* eei,
|
right_value(const Expression_eval_info* eei,
|
Output_section** section_pointer,
|
Output_section** section_pointer,
|
Line 348... |
Line 363... |
eei->check_assertions,
|
eei->check_assertions,
|
eei->is_dot_available,
|
eei->is_dot_available,
|
eei->dot_value,
|
eei->dot_value,
|
eei->dot_section,
|
eei->dot_section,
|
section_pointer,
|
section_pointer,
|
alignment_pointer);
|
alignment_pointer,
|
|
false);
|
}
|
}
|
|
|
void
|
void
|
left_print(FILE* f) const
|
left_print(FILE* f) const
|
{ this->left_->print(f); }
|
{ this->left_->print(f); }
|
Line 498... |
Line 514... |
eei->check_assertions,
|
eei->check_assertions,
|
eei->is_dot_available,
|
eei->is_dot_available,
|
eei->dot_value,
|
eei->dot_value,
|
eei->dot_section,
|
eei->dot_section,
|
section_pointer,
|
section_pointer,
|
NULL);
|
NULL,
|
|
false);
|
}
|
}
|
|
|
uint64_t
|
uint64_t
|
arg2_value(const Expression_eval_info* eei,
|
arg2_value(const Expression_eval_info* eei,
|
Output_section** section_pointer,
|
Output_section** section_pointer,
|
Line 512... |
Line 529... |
eei->check_assertions,
|
eei->check_assertions,
|
eei->is_dot_available,
|
eei->is_dot_available,
|
eei->dot_value,
|
eei->dot_value,
|
eei->dot_section,
|
eei->dot_section,
|
section_pointer,
|
section_pointer,
|
alignment_pointer);
|
alignment_pointer,
|
|
false);
|
}
|
}
|
|
|
uint64_t
|
uint64_t
|
arg3_value(const Expression_eval_info* eei,
|
arg3_value(const Expression_eval_info* eei,
|
Output_section** section_pointer,
|
Output_section** section_pointer,
|
Line 526... |
Line 544... |
eei->check_assertions,
|
eei->check_assertions,
|
eei->is_dot_available,
|
eei->is_dot_available,
|
eei->dot_value,
|
eei->dot_value,
|
eei->dot_section,
|
eei->dot_section,
|
section_pointer,
|
section_pointer,
|
alignment_pointer);
|
alignment_pointer,
|
|
false);
|
}
|
}
|
|
|
void
|
void
|
arg1_print(FILE* f) const
|
arg1_print(FILE* f) const
|
{ this->arg1_->print(f); }
|
{ this->arg1_->print(f); }
|