+2005-11-16 Alan Modra <amodra@bigpond.net.au>
+
+ * ldlang.h (lang_output_section_statement_type): Add prev.
+ * ldlang.c (new_afile): Always init header.type.
+ (output_statement_newfunc): Set os.prev.
+ (output_prev_sec_find): Use os.prev.
+ (lang_enter_output_section_statement): Formatting.
+ (lang_final, lang_add_target, lang_add_fill): Likewise.
+ (lang_add_data, lang_add_reloc): Likewise.
+ (lang_add_attribute): Only alloc the header.
+
2005-11-16 Alan Modra <amodra@bigpond.net.au>
* ld.texinfo (Forced Output Alignment): Specify that this is an
else
{
p = stat_alloc (sizeof (lang_input_statement_type));
+ p->header.type = lang_input_statement_enum;
p->header.next = NULL;
}
(lang_statement_union_type *) &ret->os,
&ret->os.header.next);
+ ret->os.prev = &((*lang_output_section_statement.tail)
+ ->output_section_statement);
/* GCC's strict aliasing rules prevent us from just casting the
address, so we store the pointer in a variable and cast that
instead. */
static asection *
output_prev_sec_find (lang_output_section_statement_type *os)
{
- asection *s = (asection *) NULL;
lang_output_section_statement_type *lookup;
- for (lookup = &lang_output_section_statement.head->output_section_statement;
- lookup != NULL;
- lookup = lookup->next)
+ for (lookup = os->prev; lookup != NULL; lookup = lookup->prev)
{
if (lookup->constraint == -1)
continue;
- if (lookup == os)
- return s;
if (lookup->bfd_section != NULL && lookup->bfd_section->owner != NULL)
- s = lookup->bfd_section;
+ return lookup->bfd_section;
}
return NULL;
{
lang_output_section_statement_type *os;
- current_section =
- os =
- lang_output_section_statement_lookup_1 (output_section_statement_name,
- constraint);
+ os = lang_output_section_statement_lookup_1 (output_section_statement_name,
+ constraint);
+ current_section = os;
/* Make next things chain into subchain of this. */
void
lang_final (void)
{
- lang_output_statement_type *new =
- new_stat (lang_output_statement, stat_ptr);
+ lang_output_statement_type *new;
+ new = new_stat (lang_output_statement, stat_ptr);
new->name = output_filename;
}
void
lang_add_target (const char *name)
{
- lang_target_statement_type *new = new_stat (lang_target_statement,
- stat_ptr);
+ lang_target_statement_type *new;
+ new = new_stat (lang_target_statement, stat_ptr);
new->target = name;
-
}
void
void
lang_add_fill (fill_type *fill)
{
- lang_fill_statement_type *new = new_stat (lang_fill_statement,
- stat_ptr);
+ lang_fill_statement_type *new;
+ new = new_stat (lang_fill_statement, stat_ptr);
new->fill = fill;
}
void
lang_add_data (int type, union etree_union *exp)
{
+ lang_data_statement_type *new;
- lang_data_statement_type *new = new_stat (lang_data_statement,
- stat_ptr);
-
+ new = new_stat (lang_data_statement, stat_ptr);
new->exp = exp;
new->type = type;
-
}
/* Create a new reloc statement. RELOC is the BFD relocation type to
lang_assignment_statement_type *
lang_add_assignment (etree_type *exp)
{
- lang_assignment_statement_type *new = new_stat (lang_assignment_statement,
- stat_ptr);
+ lang_assignment_statement_type *new;
+ new = new_stat (lang_assignment_statement, stat_ptr);
new->exp = exp;
return new;
}
void
lang_add_attribute (enum statement_enum attribute)
{
- new_statement (attribute, sizeof (lang_statement_union_type), stat_ptr);
+ new_statement (attribute, sizeof (lang_statement_header_type), stat_ptr);
}
void