mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
Produce output file with -noinhibit-exec after overlapping FDE error
* elf-eh-frame (_bfd_elf_write_section_eh_frame_hdr): Don't return false for overflow or overlapping FDEs. Give more detail in error messages.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2014-09-22 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Don't return
|
||||||
|
false for overflow or overlapping FDEs. Give more detail in
|
||||||
|
error messages.
|
||||||
|
|
||||||
2014-09-22 Andrew Bennett <andrew.bennett@imgtec.com>
|
2014-09-22 Andrew Bennett <andrew.bennett@imgtec.com>
|
||||||
|
|
||||||
* elfxx-mips.c (mips_elf_calculate_relocation): Don't sign extend
|
* elfxx-mips.c (mips_elf_calculate_relocation): Don't sign extend
|
||||||
|
@ -1807,13 +1807,10 @@ _bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
|
|||||||
if (contents[2] != DW_EH_PE_omit)
|
if (contents[2] != DW_EH_PE_omit)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bfd_boolean overlap, overflow;
|
|
||||||
|
|
||||||
bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
|
bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
|
||||||
qsort (hdr_info->array, hdr_info->fde_count,
|
qsort (hdr_info->array, hdr_info->fde_count,
|
||||||
sizeof (*hdr_info->array), vma_compare);
|
sizeof (*hdr_info->array), vma_compare);
|
||||||
overlap = FALSE;
|
|
||||||
overflow = FALSE;
|
|
||||||
for (i = 0; i < hdr_info->fde_count; i++)
|
for (i = 0; i < hdr_info->fde_count; i++)
|
||||||
{
|
{
|
||||||
bfd_vma val;
|
bfd_vma val;
|
||||||
@ -1823,31 +1820,28 @@ _bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
|
|||||||
if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64
|
if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64
|
||||||
&& (hdr_info->array[i].initial_loc
|
&& (hdr_info->array[i].initial_loc
|
||||||
!= sec->output_section->vma + val))
|
!= sec->output_section->vma + val))
|
||||||
overflow = TRUE;
|
(*info->callbacks->einfo)
|
||||||
|
(_("%X%P: .eh_frame_hdr table[%u] pc overflow.\n"), i);
|
||||||
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
|
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
|
||||||
|
|
||||||
val = hdr_info->array[i].fde - sec->output_section->vma;
|
val = hdr_info->array[i].fde - sec->output_section->vma;
|
||||||
val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000;
|
val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000;
|
||||||
if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64
|
if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64
|
||||||
&& (hdr_info->array[i].fde
|
&& (hdr_info->array[i].fde
|
||||||
!= sec->output_section->vma + val))
|
!= sec->output_section->vma + val))
|
||||||
overflow = TRUE;
|
(*info->callbacks->einfo)
|
||||||
|
(_("%X%P: .eh_frame_hdr table[%u] fde overflow.\n"), i);
|
||||||
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
|
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
|
||||||
|
|
||||||
if (i != 0
|
if (i != 0
|
||||||
&& (hdr_info->array[i].initial_loc
|
&& (hdr_info->array[i].initial_loc
|
||||||
< (hdr_info->array[i - 1].initial_loc
|
< (hdr_info->array[i - 1].initial_loc
|
||||||
+ hdr_info->array[i - 1].range)))
|
+ hdr_info->array[i - 1].range)))
|
||||||
overlap = TRUE;
|
(*info->callbacks->einfo)
|
||||||
}
|
(_("%X%P: .eh_frame_hdr table[%u] FDE at %V overlaps "
|
||||||
if (overflow)
|
"table[%u] FDE at %V.\n"),
|
||||||
(*info->callbacks->einfo)
|
i - 1, hdr_info->array[i - 1].fde,
|
||||||
(_("%P: .eh_frame_hdr entry overflow.\n"));
|
i, hdr_info->array[i].fde);
|
||||||
if (overlap)
|
|
||||||
(*info->callbacks->einfo)
|
|
||||||
(_("%P: .eh_frame_hdr refers to overlapping FDEs.\n"));
|
|
||||||
if (overflow || overlap)
|
|
||||||
{
|
|
||||||
bfd_set_error (bfd_error_bad_value);
|
|
||||||
retval = FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user