summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-07-22 11:19:01 +0000
committerNick Clifton <nickc@redhat.com>2008-07-22 11:19:01 +0000
commit936b354644e877d39670ee6e5fb8613e0708e80f (patch)
tree691cc09e447454a303d7ee71edf0d4dac8b1eff2
parent83448281dd954af6ad9b5ca1d451026e73b2ed26 (diff)
downloadgdb-936b354644e877d39670ee6e5fb8613e0708e80f.tar.gz
* elf.c (_bfd_elf_map_sections_to_segments): Allow sections in
adjoining pages to be included in the same segment.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3616c0f5c18..1b5f018eb9e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-22 Nick Clifton <nickc@redhat.com>
+
+ * elf.c (_bfd_elf_map_sections_to_segments): Allow sections in
+ adjoining pages to be included in the same segment.
+
2008-07-22 Simon Baldwin <simonb@google.com>
* elflink.c (elf_link_output_extsym): Set st_size to zero for
diff --git a/bfd/elf.c b/bfd/elf.c
index 24ab2c0bfb9..a7cc4a596f6 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3720,8 +3720,15 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
segment. */
new_segment = TRUE;
}
- else if (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize)
- < BFD_ALIGN (hdr->lma, maxpagesize))
+ /* In the next test we have to be careful when last_hdr->lma is close
+ to the end of the address space. If the aligned address wraps
+ around to the start of the address space, then there are no more
+ pages left in memory and it is OK to assume that the current
+ section can be included in the current segment. */
+ else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize
+ > last_hdr->lma)
+ && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize
+ < hdr->lma))
{
/* If putting this section in this segment would force us to
skip a page in the segment, then we need a new segment. */