PR 12763
authorAlan Modra <amodra@gmail.com>
Mon, 23 May 2011 05:41:01 +0000 (05:41 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 23 May 2011 05:41:01 +0000 (05:41 +0000)
bfd/
* elf.c (assign_file_positions_for_load_sections): Set sh_offset for
.tbss, and page align same for all SHT_NOBITS sections.
ld/
* ldlang.c (lang_output_section_find_by_flags): Match orphan .sdata2
like sections to existing .sdata2, and similarly for orphan TLS
sections.
* emultempl/elf32.em (place_orphan): Exclude .tbss from orphan_bss.

bfd/ChangeLog
bfd/elf.c
ld/ChangeLog
ld/ldlang.c

index 4517a4f46e6587ef839a10ebee69c49b06ff356f..36675c24cb498779f466cc1cd88fbfdf4c7bdd96 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-23  Alan Modra  <amodra@gmail.com>
+
+       PR 12763
+       * elf.c (assign_file_positions_for_load_sections): Set sh_offset for
+       .tbss, and page align same for all SHT_NOBITS sections.
+
 2011-05-21  Alan Modra  <amodra@gmail.com>
 
        PR 12763
index ffc9c8e2d538cb8403ef323aafa60bffdd131792..3d44ef8d2878d44a37e3ddb33b862c5cb92b4c8f 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4684,11 +4684,24 @@ assign_file_positions_for_load_sections (bfd *abfd,
            }
          else
            {
-             if (p->p_type == PT_LOAD)
+             if (p->p_type == PT_LOAD
+                 || (this_hdr->sh_type == SHT_NOBITS
+                     && (this_hdr->sh_flags & SHF_TLS) != 0
+                     && this_hdr->sh_offset == 0))
                {
-                 this_hdr->sh_offset = sec->filepos = off;
-                 if (this_hdr->sh_type != SHT_NOBITS)
-                   off += this_hdr->sh_size;
+                 if (this_hdr->sh_type == SHT_NOBITS)
+                   {
+                     /* These sections don't really need sh_offset,
+                        but give them one anyway.  */
+                     bfd_vma adjust = vma_page_aligned_bias (this_hdr->sh_addr,
+                                                             off, align);
+                     this_hdr->sh_offset = sec->filepos = off + adjust;
+                   }
+                 else
+                   {
+                     this_hdr->sh_offset = sec->filepos = off;
+                     off += this_hdr->sh_size;
+                   }
                }
 
              if (this_hdr->sh_type != SHT_NOBITS)
index d0b21575b36e0087e1a3bbd1a251e9a85f3f4800..2cce57b998bad57f354d19c0ff8bccb3c84bbd98 100644 (file)
@@ -1,3 +1,11 @@
+2011-05-23  Alan Modra  <amodra@gmail.com>
+
+       PR 12763
+       * ldlang.c (lang_output_section_find_by_flags): Match orphan .sdata2
+       like sections to existing .sdata2, and similarly for orphan TLS
+       sections.
+       * emultempl/elf32.em (place_orphan): Exclude .tbss from orphan_bss.
+
 2011-05-17  Tomohiro Kashiwada  <kikairoya@gmail.com>
 
        PR ld/12759
index 5ccb36f514f29e6df401bcdd5294eacce441f321..7cf5108e4790d6e5aff16792238b3752e0b662fb 100644 (file)
@@ -1579,8 +1579,14 @@ lang_output_section_find_by_flags (const asection *sec,
            }
          flags ^= sec->flags;
          if (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD
-                        | SEC_READONLY))
-             && !(look->flags & (SEC_SMALL_DATA | SEC_THREAD_LOCAL)))
+                        | SEC_READONLY | SEC_SMALL_DATA))
+             || (!(flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD
+                            | SEC_READONLY))
+                 && !(look->flags & SEC_SMALL_DATA))
+             || (!(flags & (SEC_THREAD_LOCAL | SEC_ALLOC))
+                 && (look->flags & SEC_THREAD_LOCAL)
+                 && (!(flags & SEC_LOAD)
+                     || (look->flags & SEC_LOAD))))
            found = look;
        }
     }
This page took 0.032663 seconds and 4 git commands to generate.