X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=bfd%2Fcoff-tic4x.c;h=307cc6fb60afdb646bd5f7a3533e4b79d200fa6e;hb=48558a5e5471a5b6d084dbb836af333b85b4123c;hp=366331ed3e774552aa22aac93169d642f127124a;hpb=07d6d2b8345ef3dc82eab49635acac9ee67dbb18;p=binutils-gdb.git diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c index 366331ed3e7..307cc6fb60a 100644 --- a/bfd/coff-tic4x.c +++ b/bfd/coff-tic4x.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C4X coff binaries. - Copyright (C) 1996-2017 Free Software Foundation, Inc. + Copyright (C) 1996-2023 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) @@ -41,13 +41,13 @@ tic4x_reloc_processing (arelent *, struct internal_reloc *, /* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local labels. */ -static bfd_boolean +static bool ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) { if (TICOFF_LOCAL_LABEL_P(name)) - return TRUE; - return FALSE; + return true; + return false; } #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name @@ -92,20 +92,20 @@ tic4x_relocation (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type tic4x_howto_table[] = { - HOWTO(R_RELWORD, 0, 2, 16, FALSE, 0, complain_overflow_signed, tic4x_relocation, "RELWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_REL24, 0, 2, 24, FALSE, 0, complain_overflow_bitfield, tic4x_relocation, "REL24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), - HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_dont, tic4x_relocation, "RELLONG", TRUE, 0xffffffff, 0xffffffff, FALSE), - HOWTO(R_PCRWORD, 0, 2, 16, TRUE, 0, complain_overflow_signed, tic4x_relocation, "PCRWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_PCR24, 0, 2, 24, TRUE, 0, complain_overflow_signed, tic4x_relocation, "PCR24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), - HOWTO(R_PARTLS16, 0, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "PARTLS16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_PARTMS8, 16, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "PARTMS8", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_RELWORD, 0, 2, 16, FALSE, 0, complain_overflow_signed, tic4x_relocation, "ARELWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_REL24, 0, 2, 24, FALSE, 0, complain_overflow_signed, tic4x_relocation, "AREL24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), - HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_signed, tic4x_relocation, "ARELLONG", TRUE, 0xffffffff, 0xffffffff, FALSE), - HOWTO(R_PCRWORD, 0, 2, 16, TRUE, 0, complain_overflow_signed, tic4x_relocation, "APCRWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_PCR24, 0, 2, 24, TRUE, 0, complain_overflow_signed, tic4x_relocation, "APCR24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), - HOWTO(R_PARTLS16, 0, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "APARTLS16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), - HOWTO(R_PARTMS8, 16, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "APARTMS8", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_RELWORD, 0, 4, 16, false, 0, complain_overflow_signed, tic4x_relocation, "RELWORD", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_REL24, 0, 4, 24, false, 0, complain_overflow_bitfield, tic4x_relocation, "REL24", true, 0x00ffffff, 0x00ffffff, false), + HOWTO(R_RELLONG, 0, 4, 32, false, 0, complain_overflow_dont, tic4x_relocation, "RELLONG", true, 0xffffffff, 0xffffffff, false), + HOWTO(R_PCRWORD, 0, 4, 16, true, 0, complain_overflow_signed, tic4x_relocation, "PCRWORD", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_PCR24, 0, 4, 24, true, 0, complain_overflow_signed, tic4x_relocation, "PCR24", true, 0x00ffffff, 0x00ffffff, false), + HOWTO(R_PARTLS16, 0, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "PARTLS16", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_PARTMS8, 16, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "PARTMS8", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_RELWORD, 0, 4, 16, false, 0, complain_overflow_signed, tic4x_relocation, "ARELWORD", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_REL24, 0, 4, 24, false, 0, complain_overflow_signed, tic4x_relocation, "AREL24", true, 0x00ffffff, 0x00ffffff, false), + HOWTO(R_RELLONG, 0, 4, 32, false, 0, complain_overflow_signed, tic4x_relocation, "ARELLONG", true, 0xffffffff, 0xffffffff, false), + HOWTO(R_PCRWORD, 0, 4, 16, true, 0, complain_overflow_signed, tic4x_relocation, "APCRWORD", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_PCR24, 0, 4, 24, true, 0, complain_overflow_signed, tic4x_relocation, "APCR24", true, 0x00ffffff, 0x00ffffff, false), + HOWTO(R_PARTLS16, 0, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "APARTLS16", true, 0x0000ffff, 0x0000ffff, false), + HOWTO(R_PARTMS8, 16, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "APARTMS8", true, 0x0000ffff, 0x0000ffff, false), }; #define HOWTO_SIZE (sizeof(tic4x_howto_table) / sizeof(tic4x_howto_table[0])) @@ -165,7 +165,8 @@ tic4x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, Called after some initial checking by the tic4x_rtype_to_howto fn below. */ static void -tic4x_lookup_howto (arelent *internal, +tic4x_lookup_howto (bfd *abfd, + arelent *internal, struct internal_reloc *dst) { unsigned int i; @@ -180,13 +181,13 @@ tic4x_lookup_howto (arelent *internal, } } - _bfd_error_handler (_("Unrecognized reloc type 0x%x"), - (unsigned int) dst->r_type); + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), + abfd, (unsigned int) dst->r_type); abort(); } static reloc_howto_type * -coff_tic4x_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, +coff_tic4x_rtype_to_howto (bfd *abfd, asection *sec, struct internal_reloc *rel, struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, @@ -201,7 +202,7 @@ coff_tic4x_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, in the output section. */ *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma; - tic4x_lookup_howto (&genrel, rel); + tic4x_lookup_howto (abfd, &genrel, rel); return genrel.howto; } @@ -218,13 +219,13 @@ tic4x_reloc_processing (arelent *relent, relent->address = reloc->r_vaddr; - if (reloc->r_symndx != -1) + if (reloc->r_symndx != -1 && symbols != NULL) { if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) { _bfd_error_handler /* xgettext: c-format */ - (_("%B: warning: illegal symbol index %ld in relocs"), + (_("%pB: warning: illegal symbol index %ld in relocs"), abfd, reloc->r_symndx); relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; @@ -256,7 +257,7 @@ tic4x_reloc_processing (arelent *relent, /* !! relent->section = (asection *) NULL; */ /* Fill in the relent->howto field from reloc->r_type. */ - tic4x_lookup_howto (relent, reloc); + tic4x_lookup_howto (abfd, relent, reloc); }