summaryrefslogtreecommitdiff
path: root/bfd/pdp11.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-02-24 10:13:51 +0000
committerNick Clifton <nickc@redhat.com>2015-02-24 10:13:51 +0000
commit3ad797fd086ee8eb71041992877e6d169266b4b5 (patch)
treeb9949332a3cb2683f7a0ed0475655b9ec56ebec2 /bfd/pdp11.c
parentec86f43468e2591127c493d67882de59dbfd79de (diff)
Fix the gas test align2 for the PDP11 by ensuring that the .text and .data sections are written to their aligned sizes.
* pdp11.c (set_section_contents): Pad the .text and .data sections to their aligned sizes.
Diffstat (limited to 'bfd/pdp11.c')
-rw-r--r--bfd/pdp11.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 0c2bb13675..241e3582f3 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1172,6 +1172,14 @@ NAME (aout, set_section_contents) (bfd *abfd,
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
return FALSE;
+
+ /* If necessary, pad the section to its aligned size. */
+ if ((section == obj_datasec (abfd)
+ || section == obj_textsec (abfd))
+ && count < section->size
+ && (bfd_seek (abfd, section->filepos + offset + section->size - 1, SEEK_SET) != 0
+ || bfd_bwrite ("", 1, abfd) != 1))
+ return FALSE;
}
return TRUE;