lang_output_section_statement_type *os;
asection **section;
lang_statement_union_type **stmt;
+ lang_statement_union_type **os_tail;
};
static bfd_boolean
const char *secname;
const char *ps = NULL;
lang_output_section_statement_type *os;
+ lang_statement_union_type **os_tail;
etree_type *load_base;
int isdyn = 0;
exp_nameop (ADDR, secname));
}
+ os_tail = lang_output_section_statement.tail;
os = lang_enter_output_section_statement (secname, address, 0,
(bfd_vma) 0,
(etree_type *) NULL,
read/write section before or amongst the read-only ones. */
if (add.head != NULL)
{
+ lang_statement_union_type *newly_added_os;
+
if (place->stmt == NULL)
{
/* Put the new statement list right at the head. */
*add.tail = place->os->header.next;
place->os->header.next = add.head;
+
+ place->os_tail = &place->os->next;
}
else
{
/* Save the end of this list. */
place->stmt = add.tail;
+
+ /* Do the same for the list of output section statements. */
+ newly_added_os = *os_tail;
+ *os_tail = NULL;
+ newly_added_os->output_section_statement.next = *place->os_tail;
+ *place->os_tail = newly_added_os;
+ place->os_tail = &newly_added_os->output_section_statement.next;
+
+ /* Fixing the global list pointer here is a little different.
+ We added to the list in lang_enter_output_section_statement,
+ trimmed off the new output_section_statment above when
+ assigning *os_tail = NULL, but possibly added it back in
+ the same place when assigning *place->os_tail. */
+ if (*os_tail == NULL)
+ lang_output_section_statement.tail = os_tail;
}
}