forked from Imagelibrary/binutils-gdb
Place .shstrtab before debug sections
This commit is contained in:
15
bfd/elf.c
15
bfd/elf.c
@@ -5616,7 +5616,7 @@ static bfd_boolean
|
|||||||
_bfd_elf_assign_file_positions_for_non_load (bfd *abfd)
|
_bfd_elf_assign_file_positions_for_non_load (bfd *abfd)
|
||||||
{
|
{
|
||||||
file_ptr off;
|
file_ptr off;
|
||||||
Elf_Internal_Shdr **shdrpp, **end_shdrpp;
|
Elf_Internal_Shdr **shdrpp, **end_shdrpp, **debug_shdrpp = NULL;
|
||||||
Elf_Internal_Shdr *shdrp;
|
Elf_Internal_Shdr *shdrp;
|
||||||
Elf_Internal_Ehdr *i_ehdrp;
|
Elf_Internal_Ehdr *i_ehdrp;
|
||||||
const struct elf_backend_data *bed;
|
const struct elf_backend_data *bed;
|
||||||
@@ -5677,11 +5677,15 @@ _bfd_elf_assign_file_positions_for_non_load (bfd *abfd)
|
|||||||
name, FALSE))
|
name, FALSE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (debug_shdrpp == NULL)
|
||||||
|
debug_shdrpp = shdrpp;
|
||||||
|
|
||||||
/* Update section size and contents. */
|
/* Update section size and contents. */
|
||||||
shdrp->sh_size = sec->size;
|
shdrp->sh_size = sec->size;
|
||||||
shdrp->contents = sec->contents;
|
shdrp->contents = sec->contents;
|
||||||
shdrp->bfd_section->contents = NULL;
|
shdrp->bfd_section->contents = NULL;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
off = _bfd_elf_assign_file_position_for_section (shdrp,
|
off = _bfd_elf_assign_file_position_for_section (shdrp,
|
||||||
off,
|
off,
|
||||||
TRUE);
|
TRUE);
|
||||||
@@ -5696,6 +5700,15 @@ _bfd_elf_assign_file_positions_for_non_load (bfd *abfd)
|
|||||||
shdrp->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
|
shdrp->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
|
||||||
off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE);
|
off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE);
|
||||||
|
|
||||||
|
/* Place DWARF debug sections after section name section. */
|
||||||
|
if (debug_shdrpp)
|
||||||
|
for (shdrpp = debug_shdrpp; shdrpp < end_shdrpp; shdrpp++)
|
||||||
|
{
|
||||||
|
shdrp = *shdrpp;
|
||||||
|
if (shdrp->sh_offset == -1)
|
||||||
|
off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Place the section headers. */
|
/* Place the section headers. */
|
||||||
i_ehdrp = elf_elfheader (abfd);
|
i_ehdrp = elf_elfheader (abfd);
|
||||||
bed = get_elf_backend_data (abfd);
|
bed = get_elf_backend_data (abfd);
|
||||||
|
|||||||
Reference in New Issue
Block a user