This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix the gas test align2 for the PDP11 by ensuring that the .text and .data sections are written to t


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3ad797fd086ee8eb71041992877e6d169266b4b5

commit 3ad797fd086ee8eb71041992877e6d169266b4b5
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Feb 24 10:13:51 2015 +0000

    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.

Diff:
---
 bfd/ChangeLog | 5 +++++
 bfd/pdp11.c   | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index efa539c..24e2176 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-24  Nick Clifton  <nickc@redhat.com>
+
+	* pdp11.c (set_section_contents): Pad the .text and .data sections
+	to their aligned sizes.
+
 2015-02-23  Yoshinori Sato <ysato@users.sourceforge.jp>
 
 	* config.bfd: Add h8300-*-linux.
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 0c2bb13..241e358 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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]