PR 1042
authorAlan Modra <amodra@gmail.com>
Mon, 4 Jul 2005 10:30:09 +0000 (10:30 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 4 Jul 2005 10:30:09 +0000 (10:30 +0000)
* elf.c (assign_file_positions_for_segments): Remove excluded
sections from the segment map.

bfd/ChangeLog
bfd/elf.c

index 388c568d9f66117ba8a0da4e6cc6cd42e1c51e9e..87d7ee4c63200d34f215566c2399129c54f468eb 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-04  Alan Modra  <amodra@bigpond.net.au>
+
+       PR 1042
+       * elf.c (assign_file_positions_for_segments): Remove excluded
+       sections from the segment map.
+
 2005-07-04  Alan Modra  <amodra@bigpond.net.au>
 
        PR 1004
index 5bbe6503a24d07d1a1c6f3d8b6a9c2498b316b61..0f9b6c27b9e116a735a33bb4c339826c767c5a03 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4044,7 +4044,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
     {
       /* The placement algorithm assumes that non allocated sections are
         not in PT_LOAD segments.  We ensure this here by removing such
-        sections from the segment map.  */
+        sections from the segment map.  We also remove excluded
+        sections.  */
       for (m = elf_tdata (abfd)->segment_map;
           m != NULL;
           m = m->next)
@@ -4052,13 +4053,12 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
          unsigned int new_count;
          unsigned int i;
 
-         if (m->p_type != PT_LOAD)
-           continue;
-
          new_count = 0;
          for (i = 0; i < m->count; i ++)
            {
-             if ((m->sections[i]->flags & SEC_ALLOC) != 0)
+             if ((m->sections[i]->flags & SEC_EXCLUDE) == 0
+                 && ((m->sections[i]->flags & SEC_ALLOC) != 0
+                     || m->p_type != PT_LOAD))
                {
                  if (i != new_count)
                    m->sections[new_count] = m->sections[i];