diff options
author | Alan Modra <amodra@bigpond.net.au> | 2011-05-23 05:40:59 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2011-05-23 05:40:59 +0000 |
commit | ef88e8e245a8d61afbe17fe8d9b02b3a11f4e197 (patch) | |
tree | cb77e7be36bdc1d730574578f3c3fa7fa4b2b3f7 /bfd/elf.c | |
parent | f30faf81057393bb5121622ea25820391d6a20b6 (diff) | |
download | binutils-redhat-ef88e8e245a8d61afbe17fe8d9b02b3a11f4e197.tar.gz |
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/elf.c')
-rw-r--r-- | bfd/elf.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -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) |