aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-11-21 21:31:18 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-11-21 21:31:18 +0000
commitf1d85785136b9335f837775031f4dba0124462db (patch)
treea06b890a356e440d206c0d3631ecb3af27bc51d2 /bfd
parenta3f548ed8589b815eb5141825c73d3871d0d1786 (diff)
downloadgdb-f1d85785136b9335f837775031f4dba0124462db.zip
gdb-f1d85785136b9335f837775031f4dba0124462db.tar.gz
gdb-f1d85785136b9335f837775031f4dba0124462db.tar.bz2
Set output maxpagesize when rewriting program header
bfd/ PR binutils/14493 * elf.c (copy_elf_program_header): When rewriting program header, set the output maxpagesize to the maximum alignment of input PT_LOAD segments. 2012-11-21 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14493 * ld-elf/maxpage5.d: New file. * ld-elf/maxpage5.s: Likewise. * ld-elf/maxpage5.t: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf.c20
2 files changed, 27 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 96fdcd4..ff60564 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2012-11-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/14493
+ * elf.c (copy_elf_program_header): When rewriting program
+ header, set the output maxpagesize to the maximum alignment
+ of input PT_LOAD segments.
+
2012-11-21 Roland McGrath <mcgrathr@google.com>
* elf-nacl.c (segment_nonexecutable_and_has_contents): Renamed to ...
diff --git a/bfd/elf.c b/bfd/elf.c
index b8bb6d3..a936636 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6356,6 +6356,26 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
}
rewrite:
+ if (ibfd->xvec == obfd->xvec)
+ {
+ /* When rewriting program header, set the output maxpagesize to
+ the maximum alignment of input PT_LOAD segments. */
+ Elf_Internal_Phdr *segment;
+ unsigned int i;
+ unsigned int num_segments = elf_elfheader (ibfd)->e_phnum;
+ bfd_vma maxpagesize = 0;
+
+ for (i = 0, segment = elf_tdata (ibfd)->phdr;
+ i < num_segments;
+ i++, segment++)
+ if (segment->p_type == PT_LOAD
+ && maxpagesize < segment->p_align)
+ maxpagesize = segment->p_align;
+
+ if (maxpagesize != get_elf_backend_data (obfd)->maxpagesize)
+ bfd_emul_set_maxpagesize (bfd_get_target (obfd), maxpagesize);
+ }
+
return rewrite_elf_program_header (ibfd, obfd);
}