aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-rs6000.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-12-15 22:10:27 +1030
committerAlan Modra <amodra@gmail.com>2020-12-16 15:17:53 +1030
commit342371d54cbbddf4342e1b261ad7c0941d7912d3 (patch)
tree4a04f06ce0a0f72dd55976679b28694d0570e9d2 /bfd/coff-rs6000.c
parent61d2295d723c7d202f530ccca1eacb4cfedf06d9 (diff)
downloadbinutils-342371d54cbbddf4342e1b261ad7c0941d7912d3.zip
binutils-342371d54cbbddf4342e1b261ad7c0941d7912d3.tar.gz
binutils-342371d54cbbddf4342e1b261ad7c0941d7912d3.tar.bz2
XCOFF constify
There are occasions where it is reasonable to use a macro defining function parameters, but this isn't one of them. Use typedefs instead, which also simplifies declaring a const array of function pointers. * libxcoff.h (struct xcoff_backend_data_rec): Constify _xcoff_glink_code. (XCOFF_RELOC_FUNCTION_ARGS, XCOFF_COMPLAIN_FUNCTION_ARGS): Delete. (xcoff_reloc_function, xcoff_complain_function): New typedef. (xcoff_calculate_relocation, xcoff_complain_overflow), (xcoff_reloc_type_noop, xcoff_reloc_type_fail), (xcoff_reloc_type_pos, xcoff_reloc_type_neg), (xcoff_reloc_type_rel, xcoff_reloc_type_toc), (xcoff_reloc_type_ba, xcoff_reloc_type_crel): Update declaration. * coff-rs6000.c (xcoff_reloc_type_br): Declare using typedef. (xcoff_complain_overflow_dont_func): Likewise. (xcoff_complain_overflow_bitfield_func): Likewise. (xcoff_complain_overflow_signed_func): Likewise. (xcoff_complain_overflow_unsigned_func): Likewise. (xcoff_calculate_relocation, xcoff_complain_overflow): Constify. (xcoff_glink_code): Constify. * coff64-rs6000.c (xcoff64_reloc_type_br): Declare using typedef. (xcoff64_calculate_relocation, xcoff64_glink_code): Constify.
Diffstat (limited to 'bfd/coff-rs6000.c')
-rw-r--r--bfd/coff-rs6000.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 5e5b182..2854f92 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -148,19 +148,15 @@ static bfd_boolean do_pad (bfd *, unsigned int);
static bfd_boolean do_copy (bfd *, bfd *);
/* Relocation functions */
-static bfd_boolean xcoff_reloc_type_br (XCOFF_RELOC_FUNCTION_ARGS);
-
-static bfd_boolean xcoff_complain_overflow_dont_func
- (XCOFF_COMPLAIN_FUNCTION_ARGS);
-static bfd_boolean xcoff_complain_overflow_bitfield_func
- (XCOFF_COMPLAIN_FUNCTION_ARGS);
-static bfd_boolean xcoff_complain_overflow_signed_func
- (XCOFF_COMPLAIN_FUNCTION_ARGS);
-static bfd_boolean xcoff_complain_overflow_unsigned_func
- (XCOFF_COMPLAIN_FUNCTION_ARGS);
-
-bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
- (XCOFF_RELOC_FUNCTION_ARGS) =
+static xcoff_reloc_function xcoff_reloc_type_br;
+
+static xcoff_complain_function xcoff_complain_overflow_dont_func;
+static xcoff_complain_function xcoff_complain_overflow_bitfield_func;
+static xcoff_complain_function xcoff_complain_overflow_signed_func;
+static xcoff_complain_function xcoff_complain_overflow_unsigned_func;
+
+xcoff_reloc_function *const
+xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION] =
{
xcoff_reloc_type_pos, /* R_POS (0x00) */
xcoff_reloc_type_neg, /* R_NEG (0x01) */
@@ -192,8 +188,8 @@ bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
};
-bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW])
- (XCOFF_COMPLAIN_FUNCTION_ARGS) =
+xcoff_complain_function *const
+xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW] =
{
xcoff_complain_overflow_dont_func,
xcoff_complain_overflow_bitfield_func,
@@ -3981,7 +3977,7 @@ HOWTO (0, /* type */
The first word of global linkage code must be modified by filling in
the correct TOC offset. */
-static unsigned long xcoff_glink_code[9] =
+static const unsigned long xcoff_glink_code[9] =
{
0x81820000, /* lwz r12,0(r2) */
0x90410014, /* stw r2,20(r1) */