aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
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);
}