+2006-06-21 Mark Shinwell <shinwell@codesourcery.com>
+
+ * ldlang.c (lang_insert_orphan): Correctly handle the case where
+ the section is to end up after the section currently at the end
+ of the list in output_bfd.
+
2006-06-21 Hans-Peter Nilsson <hp@bitrange.com>
* emultempl/mmo.em: Improve comments. Explain why there's
place->section = &output_bfd->sections;
as = *place->section;
- if (as != snew && as->prev != snew)
+
+ if (!as)
+ {
+ /* Put the section at the end of the list. */
+
+ /* Unlink the section. */
+ bfd_section_list_remove (output_bfd, snew);
+
+ /* Now tack it back on in the right place. */
+ bfd_section_list_append (output_bfd, snew);
+ }
+ else if (as != snew && as->prev != snew)
{
/* Unlink the section. */
bfd_section_list_remove (output_bfd, snew);