#include "safe-ctype.h"
static etree_value_type exp_fold_tree_1
- (etree_type *, lang_output_section_statement_type *,
- lang_phase_type, bfd_vma, bfd_vma *, bfd_boolean);
+ (etree_type *, asection *, lang_phase_type, bfd_vma, bfd_vma *, bfd_boolean);
static etree_value_type exp_fold_tree_no_dot
- (etree_type *, lang_output_section_statement_type *, lang_phase_type,
- bfd_boolean);
+ (etree_type *, asection *, lang_phase_type, bfd_boolean);
static bfd_vma align_n
(bfd_vma, bfd_vma);
static void
make_abs (etree_value_type *ptr)
{
- asection *s = ptr->section->bfd_section;
- ptr->value += s->vma;
- ptr->section = abs_output_section;
+ ptr->value += ptr->section->vma;
+ ptr->section = bfd_abs_section_ptr;
}
static etree_value_type
{
etree_value_type new;
new.valid_p = TRUE;
- new.section = abs_output_section;
+ new.section = bfd_abs_section_ptr;
new.value = value;
new.str = NULL;
return new;
static etree_value_type
new_rel (bfd_vma value,
char *str,
- lang_output_section_statement_type *section)
+ asection *section)
{
etree_value_type new;
new.valid_p = TRUE;
}
static etree_value_type
-new_rel_from_section (bfd_vma value,
- lang_output_section_statement_type *section)
+new_rel_from_section (bfd_vma value, asection *section)
{
etree_value_type new;
new.valid_p = TRUE;
new.str = NULL;
new.section = section;
- new.value -= section->bfd_section->vma;
+ new.value -= section->vma;
return new;
}
static etree_value_type
fold_unary (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_vma dot,
bfd_vma *dotp,
case ABSOLUTE:
if (allocation_done != lang_first_phase_enum)
{
- result.value += result.section->bfd_section->vma;
- result.section = abs_output_section;
+ result.value += result.section->vma;
+ result.section = bfd_abs_section_ptr;
}
else
result.valid_p = FALSE;
case DATA_SEGMENT_END:
if (allocation_done != lang_first_phase_enum
- && current_section == abs_output_section
+ && current_section == bfd_abs_section_ptr
&& (exp_data_seg.phase == exp_dataseg_align_seen
|| exp_data_seg.phase == exp_dataseg_relro_seen
|| exp_data_seg.phase == exp_dataseg_adjust
static etree_value_type
fold_binary (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_vma dot,
bfd_vma *dotp,
absolute. However, adding or subtracting an absolute
value from a relative value is meaningful, and is an
exception. */
- if (current_section != abs_output_section
- && (other.section == abs_output_section
- || (result.section == abs_output_section
+ if (current_section != bfd_abs_section_ptr
+ && (other.section == bfd_abs_section_ptr
+ || (result.section == bfd_abs_section_ptr
&& tree->type.node_code == '+'))
&& (tree->type.node_code == '+'
|| tree->type.node_code == '-'))
{
- if (other.section != abs_output_section)
+ if (other.section != bfd_abs_section_ptr)
{
/* Keep the section of the other term. */
if (tree->type.node_code == '+')
}
}
else if (result.section != other.section
- || current_section == abs_output_section)
+ || current_section == bfd_abs_section_ptr)
{
make_abs (&result);
make_abs (&other);
case DATA_SEGMENT_ALIGN:
if (allocation_done != lang_first_phase_enum
- && current_section == abs_output_section
+ && current_section == bfd_abs_section_ptr
&& (exp_data_seg.phase == exp_dataseg_none
|| exp_data_seg.phase == exp_dataseg_adjust
|| exp_data_seg.phase == exp_dataseg_relro_adjust
static etree_value_type
fold_trinary (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_vma dot,
bfd_vma *dotp,
static etree_value_type
fold_name (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_vma dot,
bfd_boolean mark_used)
{
etree_value_type result;
- result.valid_p = FALSE;
+ memset (&result, 0, sizeof (result));
switch (tree->type.node_code)
{
|| h->type == bfd_link_hash_common)
&& (def_iteration == lang_statement_iteration
|| def_iteration == -1));
- result.section = abs_output_section;
+ result.section = bfd_abs_section_ptr;
result.valid_p = TRUE;
}
break;
tree->name.name);
else
{
- lang_output_section_statement_type *os;
-
- os = (lang_output_section_statement_lookup
- (bfd_get_section_name (output_bfd,
- output_section)));
-
/* FIXME: Is this correct if this section is
being linked with -R? */
result = new_rel ((h->u.def.value
+ h->u.def.section->output_offset),
NULL,
- os);
- os->bfd_section->flags |= SEC_KEEP;
+ output_section);
+ output_section->flags |= SEC_KEEP;
}
}
}
{
os->bfd_section->flags |= SEC_KEEP;
if (os->processed > 0)
- result = new_rel (0, NULL, os);
+ result = new_rel (0, NULL, os->bfd_section);
}
}
break;
if (os->processed != 0)
{
if (os->load_base == NULL)
- result = new_rel (0, NULL, os);
+ result = new_rel (0, NULL, os->bfd_section);
else
result = exp_fold_tree_no_dot (os->load_base,
- abs_output_section,
+ bfd_abs_section_ptr,
allocation_done,
mark_used);
}
static etree_value_type
exp_fold_tree_1 (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_vma dot,
bfd_vma *dotp,
einfo (_("%F%S can not PROVIDE assignment to location counter\n"));
if (allocation_done == lang_allocating_phase_enum
|| (allocation_done == lang_final_phase_enum
- && current_section == abs_output_section))
+ && current_section == bfd_abs_section_ptr))
{
/* Notify the folder that this is an assignment to dot. */
assigning_to_dot = TRUE;
{
bfd_vma nextdot;
- nextdot = (result.value
- + current_section->bfd_section->vma);
+ nextdot = result.value + current_section->vma;
if (nextdot < dot
- && current_section != abs_output_section)
+ && current_section != bfd_abs_section_ptr)
einfo (_("%F%S cannot move location counter backwards (from %V to %V)\n"),
dot, nextdot);
else
lang_update_definedness (tree->assign.dst, h);
h->type = bfd_link_hash_defined;
h->u.def.value = result.value;
- h->u.def.section = result.section->bfd_section;
+ h->u.def.section = result.section;
if (tree->type.node_class == etree_provide)
tree->type.node_class = etree_provided;
}
etree_value_type
exp_fold_tree (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_vma dot,
bfd_vma *dotp)
static etree_value_type
exp_fold_tree_no_dot (etree_type *tree,
- lang_output_section_statement_type *current_section,
+ asection *current_section,
lang_phase_type allocation_done,
bfd_boolean mark_used)
{
value.binary.rhs = rhs;
value.type.node_class = etree_binary;
r = exp_fold_tree_no_dot (&value,
- abs_output_section,
+ bfd_abs_section_ptr,
lang_first_phase_enum, FALSE);
if (r.valid_p)
{
value.unary.type.node_code = code;
value.unary.child = child;
value.unary.type.node_class = etree_unary;
- r = exp_fold_tree_no_dot (&value, abs_output_section,
+ r = exp_fold_tree_no_dot (&value, bfd_abs_section_ptr,
lang_first_phase_enum, FALSE);
if (r.valid_p)
return exp_intop (r.value);
if (tree != NULL)
{
- r = exp_fold_tree_no_dot (tree, abs_output_section,
+ r = exp_fold_tree_no_dot (tree, bfd_abs_section_ptr,
allocation_done, FALSE);
if (! r.valid_p && name != NULL)
einfo (_("%F%S nonconstant expression for %s\n"), name);
if (tree == NULL)
return def;
- r = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done,
+ r = exp_fold_tree_no_dot (tree, bfd_abs_section_ptr, allocation_done,
FALSE);
if (! r.valid_p && name != NULL)
einfo (_("%F%S nonconstant expression for %s\n"), name);
lang_phase_type allocation_done)
{
etree_value_type res;
- res = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done,
+ res = exp_fold_tree_no_dot (tree, bfd_abs_section_ptr, allocation_done,
FALSE);
if (res.valid_p)
- res.value += res.section->bfd_section->vma;
+ res.value += res.section->vma;
else
einfo (_("%F%S non constant expression for %s\n"), name);
}
void
-exp_mark_used_section
- (etree_type *tree,
- lang_output_section_statement_type *current_section)
+exp_mark_used_section (etree_type *tree, asection *current_section)
{
switch (tree->type.node_class)
{
lang_update_definedness (tree->assign.dst, h);
h->type = bfd_link_hash_defined;
h->u.def.value = result.value;
- h->u.def.section = result.section->bfd_section;
+ h->u.def.section = result.section;
if (tree->type.node_class == etree_provide)
tree->type.node_class = etree_provided;
}
break;
case lang_data_statement_enum:
exp_mark_used_section (s->data_statement.exp,
- abs_output_section);
+ bfd_abs_section_ptr);
break;
case lang_reloc_statement_enum:
break;
case lang_assignment_statement_enum:
exp_mark_used_section (s->assignment_statement.exp,
- output_section_statement);
+ output_section_statement->bfd_section);
break;
case lang_padding_statement_enum:
break;
computation_is_valid = is_dot || (scan_for_self_assignment (dst, tree) == FALSE);
}
- result = exp_fold_tree (tree, output_section, lang_final_phase_enum,
- print_dot, &print_dot);
+ result = exp_fold_tree (tree, output_section->bfd_section,
+ lang_final_phase_enum, print_dot, &print_dot);
if (result.valid_p)
{
bfd_vma value;
value = result.value;
if (result.section)
- value += result.section->bfd_section->vma;
+ value += result.section->vma;
minfo ("0x%V", value);
if (is_dot)
value = h->u.def.value;
if (result.section)
- value += result.section->bfd_section->vma;
+ value += result.section->vma;
minfo ("[0x%V]", value);
}
os->processed = -1;
r = exp_fold_tree (os->addr_tree,
- abs_output_section,
+ bfd_abs_section_ptr,
lang_allocating_phase_enum,
dot, &dot);
os->processed = 0;
" address expression for section %s\n"),
os->name);
- dot = r.value + r.section->bfd_section->vma;
+ dot = r.value + r.section->vma;
}
/* The section starts here.
os->processed = 1;
if (os->update_dot_tree != 0)
- exp_fold_tree (os->update_dot_tree, abs_output_section,
+ exp_fold_tree (os->update_dot_tree, bfd_abs_section_ptr,
lang_allocating_phase_enum, dot, &dot);
/* Update dot in the region ?
/* We might refer to provided symbols in the expression, and
need to mark them as needed. */
- exp_fold_tree (s->data_statement.exp, abs_output_section,
+ exp_fold_tree (s->data_statement.exp, bfd_abs_section_ptr,
lang_allocating_phase_enum, dot, &dot);
switch (s->data_statement.type)
bfd_vma newdot = dot;
exp_fold_tree (s->assignment_statement.exp,
- output_section_statement,
+ output_section_statement->bfd_section,
lang_allocating_phase_enum,
dot,
&newdot);
etree_value_type value;
value = exp_fold_tree (s->data_statement.exp,
- abs_output_section,
+ bfd_abs_section_ptr,
lang_final_phase_enum, dot, &dot);
if (!value.valid_p)
einfo (_("%F%P: invalid data statement\n"));
s->data_statement.value
- = value.value + value.section->bfd_section->vma;
+ = value.value + value.section->vma;
}
{
unsigned int size;
etree_value_type value;
value = exp_fold_tree (s->reloc_statement.addend_exp,
- abs_output_section,
+ bfd_abs_section_ptr,
lang_final_phase_enum, dot, &dot);
s->reloc_statement.addend_value = value.value;
if (!value.valid_p)
case lang_assignment_statement_enum:
{
exp_fold_tree (s->assignment_statement.exp,
- output_section_statement,
+ output_section_statement->bfd_section,
lang_final_phase_enum,
dot,
&dot);