binutils/binutils-rh1247126.patch

27 lines
1.2 KiB
Diff
Raw Normal View History

diff -Nrup a/bfd/elf.c b/bfd/elf.c
--- a/bfd/elf.c 2015-07-28 10:52:10.941754850 -0600
+++ b/bfd/elf.c 2015-07-28 10:53:34.725982912 -0600
@@ -4081,11 +4081,18 @@ _bfd_elf_map_sections_to_segments (bfd *
new_segment = TRUE;
}
else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
- && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
+ && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0
+ && ((abfd->flags & D_PAGED) == 0
+ || (((last_hdr->lma + last_size - 1) & -maxpagesize)
+ != (hdr->lma & -maxpagesize))))
{
- /* We don't want to put a loadable section after a
- nonloadable section in the same segment.
- Consider .tbss sections as loadable for this purpose. */
+ /* We don't want to put a loaded section after a
+ nonloaded (ie. bss style) section in the same segment
+ as that will force the non-loaded section to be loaded.
+ Consider .tbss sections as loaded for this purpose.
+ However, like the writable/non-writable case below,
+ if they are on the same page then they must be put
+ in the same segment. */
new_segment = TRUE;
}
else if ((abfd->flags & D_PAGED) == 0)