aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMark Shinwell <shinwell@codesourcery.com>2006-06-21 13:25:54 +0000
committerMark Shinwell <shinwell@codesourcery.com>2006-06-21 13:25:54 +0000
commit5e542ba70e7c0b145ed83ed34f2b3efbe9e08656 (patch)
tree560f59a79ab3f77c3f846497a428404ea77a150c /ld
parent42b575e54591594e33810221501585722eb80623 (diff)
downloadgdb-5e542ba70e7c0b145ed83ed34f2b3efbe9e08656.zip
gdb-5e542ba70e7c0b145ed83ed34f2b3efbe9e08656.tar.gz
gdb-5e542ba70e7c0b145ed83ed34f2b3efbe9e08656.tar.bz2
Fix for segmentation fault.
* 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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 836a73b..684d34f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/ld/ldlang.c b/ld/ldlang.c
index cc08726..9e307f8 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1445,7 +1445,18 @@ lang_insert_orphan (asection *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);