2006-10-15 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 15 Oct 2006 14:22:13 +0000 (14:22 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 15 Oct 2006 14:22:13 +0000 (14:22 +0000)
PR ld/3314
* elf.c (assign_file_positions_for_non_load_sections): Don't
page align empty SHF_ALLOC sections.

bfd/ChangeLog
bfd/elf.c

index 5310dcdab0b216ce3908f5eeeaa6b80980504cd1..7c8516e0803cc2b42d15b2d13ade62d9217ebb49 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/3314
+       * elf.c (assign_file_positions_for_non_load_sections): Don't
+       page align empty SHF_ALLOC sections.  
+
 2006-10-13  Jakub Jelinek  <jakub@redhat.com>
 
        * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): Set
index ab23a190b94860cfc0cc62745616e5eb01299b9b..010a9785b5a03c0f7de2e6dd79b1e69e42d66e42 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4665,11 +4665,12 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
          if (hdr->sh_size != 0)
            ((*_bfd_error_handler)
             (_("%B: warning: allocated section `%s' not in segment"),
-               abfd,
-               (hdr->bfd_section == NULL
-                ? "*unknown*" 
-                : hdr->bfd_section->name)));
-         if ((abfd->flags & D_PAGED) != 0)
+             abfd,
+             (hdr->bfd_section == NULL
+              ? "*unknown*"
+              : hdr->bfd_section->name)));
+         /* We don't need to page align empty sections.  */
+         if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 0)
            off += vma_page_aligned_bias (hdr->sh_addr, off,
                                          bed->maxpagesize);
          else