aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-05-23 05:41:01 +0000
committerAlan Modra <amodra@gmail.com>2011-05-23 05:41:01 +0000
commit6de6a7fe356bbb94c090d48366908f1eb8db6dbb (patch)
tree107eef4f5b74faaad05a505c8502e2f4da845ccf /bfd
parent3bd61671c358dcb210ebadfba6657453e6c07678 (diff)
downloadgdb-6de6a7fe356bbb94c090d48366908f1eb8db6dbb.zip
gdb-6de6a7fe356bbb94c090d48366908f1eb8db6dbb.tar.gz
gdb-6de6a7fe356bbb94c090d48366908f1eb8db6dbb.tar.bz2
PR 12763
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf.c21
2 files changed, 23 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4517a4f..36675c2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf.c b/bfd/elf.c
index ffc9c8e..3d44ef8 100644
--- 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)