aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/armelf.em
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl/armelf.em')
-rw-r--r--ld/emultempl/armelf.em39
1 files changed, 19 insertions, 20 deletions
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index c66d43f..e5f1514 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -813,9 +813,6 @@ gld${EMULATION_NAME}_place_orphan (file, s)
const char *outsecname;
lang_output_section_statement_type *os;
- if ((s->flags & SEC_ALLOC) == 0)
- return false;
-
/* Look through the script to see where to place this section. */
hold_section = s;
hold_use = NULL;
@@ -869,7 +866,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
&& hold_text.os != NULL)
place = &hold_text;
else
- return false;
+ place = NULL;
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
@@ -901,7 +898,7 @@ gld${EMULATION_NAME}_place_orphan (file, s)
if (snew == NULL)
einfo ("%P%F: output format %s cannot represent section called %s\n",
output_bfd->xvec->name, outsecname);
- if (place->os->bfd_section != NULL)
+ if (place != NULL && place->os->bfd_section != NULL)
{
/* Unlink it first. */
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
@@ -936,10 +933,10 @@ gld${EMULATION_NAME}_place_orphan (file, s)
<< s->alignment_power))));
}
- if (! link_info.relocateable)
- address = NULL;
- else
+ if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop ((bfd_vma) 0);
+ else
+ address = NULL;
lang_enter_output_section_statement (outsecname, address, 0,
(bfd_vma) 0,
@@ -965,20 +962,22 @@ gld${EMULATION_NAME}_place_orphan (file, s)
exp_nameop (NAME, ".")));
}
- if (! place->stmt)
- {
- /* Put the new statement list right at the head. */
- *add.tail = place->os->header.next;
- place->os->header.next = add.head;
- }
- else
+ if (place != NULL)
{
- /* Put it after the last orphan statement we added. */
- *add.tail = *place->stmt;
- *place->stmt = add.head;
+ if (! place->stmt)
+ {
+ /* Put the new statement list right at the head. */
+ *add.tail = place->os->header.next;
+ place->os->header.next = add.head;
+ }
+ else
+ {
+ /* Put it after the last orphan statement we added. */
+ *add.tail = *place->stmt;
+ *place->stmt = add.head;
+ }
+ place->stmt = add.tail; /* Save the end of this list. */
}
- place->stmt = add.tail; /* Save the end of this list. */
-
stat_ptr = old;
return true;