PR ld/12921
* elf.c (assign_file_positions_for_load_sections): Don't align sh_offset for all SHT_NOBITS sections here, just .tbss sections that don't get a PT_LOAD.
This commit is contained in:
parent
a1d509b32e
commit
1e951488fd
|
@ -1,3 +1,10 @@
|
||||||
|
2011-06-24 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR ld/12921
|
||||||
|
* elf.c (assign_file_positions_for_load_sections): Don't align
|
||||||
|
sh_offset for all SHT_NOBITS sections here, just .tbss sections
|
||||||
|
that don't get a PT_LOAD.
|
||||||
|
|
||||||
2011-06-22 Kaz Kojima <kkojima@rr.iij4u.or.jp>
|
2011-06-22 Kaz Kojima <kkojima@rr.iij4u.or.jp>
|
||||||
|
|
||||||
* elf32-sh.c (sh_elf_relocate_section): Allow R_SH_TLS_LE_32 for PIE.
|
* elf32-sh.c (sh_elf_relocate_section): Allow R_SH_TLS_LE_32 for PIE.
|
||||||
|
|
28
bfd/elf.c
28
bfd/elf.c
|
@ -4684,25 +4684,27 @@ assign_file_positions_for_load_sections (bfd *abfd,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (p->p_type == PT_LOAD
|
if (p->p_type == PT_LOAD)
|
||||||
|| (this_hdr->sh_type == SHT_NOBITS
|
{
|
||||||
|
this_hdr->sh_offset = sec->filepos = off;
|
||||||
|
if (this_hdr->sh_type != SHT_NOBITS)
|
||||||
|
off += this_hdr->sh_size;
|
||||||
|
}
|
||||||
|
else if (this_hdr->sh_type == SHT_NOBITS
|
||||||
&& (this_hdr->sh_flags & SHF_TLS) != 0
|
&& (this_hdr->sh_flags & SHF_TLS) != 0
|
||||||
&& this_hdr->sh_offset == 0))
|
&& this_hdr->sh_offset == 0)
|
||||||
{
|
{
|
||||||
if (this_hdr->sh_type == SHT_NOBITS)
|
/* This is a .tbss section that didn't get a PT_LOAD.
|
||||||
{
|
(See _bfd_elf_map_sections_to_segments "Create a
|
||||||
/* These sections don't really need sh_offset,
|
final PT_LOAD".) Set sh_offset to the value it
|
||||||
but give them one anyway. */
|
would have if we had created a zero p_filesz and
|
||||||
|
p_memsz PT_LOAD header for the section. This
|
||||||
|
also makes the PT_TLS header have the same
|
||||||
|
p_offset value. */
|
||||||
bfd_vma adjust = vma_page_aligned_bias (this_hdr->sh_addr,
|
bfd_vma adjust = vma_page_aligned_bias (this_hdr->sh_addr,
|
||||||
off, align);
|
off, align);
|
||||||
this_hdr->sh_offset = sec->filepos = off + adjust;
|
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)
|
if (this_hdr->sh_type != SHT_NOBITS)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue