diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-07 22:21:28 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-08 11:24:50 +1030 |
commit | d64c8f7181fd21f90983f8d55369f6f9a2960c43 (patch) | |
tree | 2121d1b6c59faefb19dd040ebe4eb57929782f76 /bfd/coffcode.h | |
parent | b9ee26d9ca29b5f598772de9f78c3da21cfa6c1b (diff) | |
download | binutils-d64c8f7181fd21f90983f8d55369f6f9a2960c43.zip binutils-d64c8f7181fd21f90983f8d55369f6f9a2960c43.tar.gz binutils-d64c8f7181fd21f90983f8d55369f6f9a2960c43.tar.bz2 |
z8 and z80 coff_reloc16_extra_cases sanity checks
* reloc16.c (bfd_coff_reloc16_get_relocated_section_contents):
Use size_t variables. Sanity check reloc address. Handle
errors from bfd_coff_reloc16_extra_cases.
* coffcode.h (_bfd_coff_reloc16_extra_cases): Return bool, take
size_t* args.
(dummy_reloc16_extra_cases): Adjust to suit. Don't abort.
* coff-z80.c (extra_case): Sanity check reloc address. Return
errors. Tidy formatting. Use bfd_signed_vma temp var to
check for reloc overflow. Don't abort on unexpected reloc type,
instead print an error and return false.
* coff-z8k.c (extra_case): Likewise.
* libcoff.h: Regenerate.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r-- | bfd/coffcode.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h index c4f7d19..7a4c409 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1495,9 +1495,9 @@ Special entry points for gdb to swap in coff symbol table parts: . (bfd *, FILE *, combined_entry_type *, combined_entry_type *, . combined_entry_type *, unsigned int); . -. void (*_bfd_coff_reloc16_extra_cases) +. bool (*_bfd_coff_reloc16_extra_cases) . (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, -. bfd_byte *, unsigned int *, unsigned int *); +. bfd_byte *, size_t *, size_t *); . . int (*_bfd_coff_reloc16_estimate) . (bfd *, asection *, arelent *, unsigned int, @@ -5331,18 +5331,16 @@ dummy_reloc16_estimate (bfd *abfd ATTRIBUTE_UNUSED, #define coff_reloc16_extra_cases dummy_reloc16_extra_cases -/* This works even if abort is not declared in any header file. */ - -static void +static bool dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *link_info ATTRIBUTE_UNUSED, struct bfd_link_order *link_order ATTRIBUTE_UNUSED, arelent *reloc ATTRIBUTE_UNUSED, bfd_byte *data ATTRIBUTE_UNUSED, - unsigned int *src_ptr ATTRIBUTE_UNUSED, - unsigned int *dst_ptr ATTRIBUTE_UNUSED) + size_t *src_ptr ATTRIBUTE_UNUSED, + size_t *dst_ptr ATTRIBUTE_UNUSED) { - abort (); + return false; } #endif |