summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-06-07 23:22:00 +0000
committerRichard Henderson <rth@redhat.com>1999-06-07 23:22:00 +0000
commit9177770338c78eb3ff621c63a83d086d72388fa0 (patch)
treebbe10a444741ae981796896729f351d4c2d90e6e
parent86fc4239597ab2f5f06dde7abbd9b703f40f68e0 (diff)
downloadgdb-9177770338c78eb3ff621c63a83d086d72388fa0.tar.gz
* section.c (_bfd_strip_section_from_output): Remove output
sections with no initial link_order.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/section.c24
2 files changed, 17 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3d69c295c5c..e5fd81d2ac2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+1999-06-07 Richard Henderson <rth@cygnus.com>
+
+ * section.c (_bfd_strip_section_from_output): Remove output
+ sections with no initial link_order.
+
1999-06-07 Nick Clifton <nickc@cygnus.com>
* elf32-m88k.c (ELF_MAXPAGESIZE): Define.
diff --git a/bfd/section.c b/bfd/section.c
index 18778b5362f..da4c4bcba86 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1046,30 +1046,30 @@ _bfd_strip_section_from_output (s)
asection **spp, *os;
struct bfd_link_order *p, *pp;
+ /* Excise the input section from the link order. */
os = s->output_section;
for (p = os->link_order_head, pp = NULL; p != NULL; pp = p, p = p->next)
if (p->type == bfd_indirect_link_order
&& p->u.indirect.section == s)
{
- /* Excise the input section. */
if (pp)
pp->next = p->next;
else
os->link_order_head = p->next;
if (!p->next)
os->link_order_tail = pp;
+ break;
+ }
- if (!os->link_order_head)
+ /* If the output section is empty, remove it too. */
+ if (!os->link_order_head)
+ {
+ for (spp = &os->owner->sections; *spp; spp = &(*spp)->next)
+ if (*spp == os)
{
- /* Excise the output section. */
- for (spp = &os->owner->sections; *spp; spp = &(*spp)->next)
- if (*spp == os)
- {
- *spp = os->next;
- os->owner->section_count--;
- break;
- }
+ *spp = os->next;
+ os->owner->section_count--;
+ break;
}
- break;
- }
+ }
}