diff options
author | Alan Modra <amodra@gmail.com> | 2020-12-17 08:33:39 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-12-18 10:34:16 +1030 |
commit | bd38246a45dc199ce32b50878670bbbdf7e27ad5 (patch) | |
tree | fcc0851e06cfe59387319a1ad754b6fd1f64e35c | |
parent | 7f3a18cfb58deb36e05469d94e7b9e48b19d90af (diff) | |
download | binutils-bd38246a45dc199ce32b50878670bbbdf7e27ad5.zip binutils-bd38246a45dc199ce32b50878670bbbdf7e27ad5.tar.gz binutils-bd38246a45dc199ce32b50878670bbbdf7e27ad5.tar.bz2 |
Constify more arrays
bfd/
* coff-z80.c (bfd_howto_type): Make typedef const.
* elf32-z80.c (bfd_howto_type): Likewise.
* elf32-m32c.c (EncodingTable): Likewise.
* elf32-csky.c (csky_arch_for_merge): Likewise.
(csky_archs): Use typedef.
* elf32-m68hc11.c (m68hc11_direct_relax_table): Make const.
(find_relaxable_insn, m68hc11_elf_relax_section): Adjust to suit.
* elf32-ppc.c (ppc_alt_plt): Make const.
* elf32-rl78.c (relax_addr16): Likewise.
* targets.c (_bfd_associated_vector): Likewise.
(bfd_target_vector, bfd_associated_vector): Likewise.
* libbfd-in.h (bfd_target_vector, bfd_associated_vector): Likewise.
* libbfd.h: Regenerate.
include/
* opcode/arc-attrs.h (CONFLICT_LIST): Make const.
-rw-r--r-- | bfd/ChangeLog | 16 | ||||
-rw-r--r-- | bfd/coff-z80.c | 2 | ||||
-rw-r--r-- | bfd/elf32-csky.c | 4 | ||||
-rw-r--r-- | bfd/elf32-m32c.c | 2 | ||||
-rw-r--r-- | bfd/elf32-m68hc11.c | 6 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 2 | ||||
-rw-r--r-- | bfd/elf32-rl78.c | 2 | ||||
-rw-r--r-- | bfd/elf32-z80.c | 2 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 4 | ||||
-rw-r--r-- | bfd/libbfd.h | 4 | ||||
-rw-r--r-- | bfd/targets.c | 6 | ||||
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/opcode/arc-attrs.h | 2 |
13 files changed, 38 insertions, 18 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 40d96a8..c49faa3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,21 @@ 2020-12-18 Alan Modra <amodra@gmail.com> + * coff-z80.c (bfd_howto_type): Make typedef const. + * elf32-z80.c (bfd_howto_type): Likewise. + * elf32-m32c.c (EncodingTable): Likewise. + * elf32-csky.c (csky_arch_for_merge): Likewise. + (csky_archs): Use typedef. + * elf32-m68hc11.c (m68hc11_direct_relax_table): Make const. + (find_relaxable_insn, m68hc11_elf_relax_section): Adjust to suit. + * elf32-ppc.c (ppc_alt_plt): Make const. + * elf32-rl78.c (relax_addr16): Likewise. + * targets.c (_bfd_associated_vector): Likewise. + (bfd_target_vector, bfd_associated_vector): Likewise. + * libbfd-in.h (bfd_target_vector, bfd_associated_vector): Likewise. + * libbfd.h: Regenerate. + +2020-12-18 Alan Modra <amodra@gmail.com> + * ecoff.c (bfd_debug_section): Init using BFD_FAKE_SECTION. (ecoff_scom_section, ecoff_scom_symbol): Statically init using BFD_FAKE_SECTION and GLOBAL_SYM_INIT. Delete initialisation code. diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c index 16f83cf..ced9074 100644 --- a/bfd/coff-z80.c +++ b/bfd/coff-z80.c @@ -30,7 +30,7 @@ #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 0 -typedef struct { +typedef const struct { bfd_reloc_code_real_type r_type; reloc_howto_type howto; } bfd_howto_type; diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 8d48a03..9ad78cf 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -40,7 +40,7 @@ enum merge_class CSKY_V2 }; -typedef struct csky_arch_for_merge +typedef const struct csky_arch_for_merge { const char *name; const unsigned long arch_eflag; @@ -53,7 +53,7 @@ typedef struct csky_arch_for_merge unsigned int do_warning; } csky_arch_for_merge; -static struct csky_arch_for_merge csky_archs[] = +static csky_arch_for_merge csky_archs[] = { /* 510 and 610 merge to 610 without warning. */ { "ck510", CSKY_ARCH_510, CSKY_V1, 0, 0}, diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index a0452d7..6de8c4c 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -1347,7 +1347,7 @@ static int bytes_to_reloc[] = { /* If the displacement is within the given range and the new encoding differs from the old encoding (the index), then the insn can be relaxed to the new encoding. */ -typedef struct { +typedef const struct { int bytes; unsigned int max_disp; unsigned char new_encoding; diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 7bbb489..7e66808 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -505,7 +505,7 @@ m68hc11_elf_bfd_link_hash_table_create (bfd *abfd) /* 68HC11 Linker Relaxation. */ -struct m68hc11_direct_relax +const struct m68hc11_direct_relax { const char *name; unsigned char code; @@ -548,7 +548,7 @@ struct m68hc11_direct_relax { 0, 0, 0 } }; -static struct m68hc11_direct_relax * +static const struct m68hc11_direct_relax * find_relaxable_insn (unsigned char code) { int i; @@ -962,7 +962,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, { unsigned char code; unsigned short offset; - struct m68hc11_direct_relax *rinfo; + const struct m68hc11_direct_relax *rinfo; prev_insn_branch = 0; offset = bfd_get_16 (abfd, contents + irel->r_offset); diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 66265ef..9d8fa66 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1491,7 +1491,7 @@ static const struct bfd_elf_special_section ppc_elf_special_sections[] = }; /* This is what we want for new plt/got. */ -static struct bfd_elf_special_section ppc_alt_plt = +static const struct bfd_elf_special_section ppc_alt_plt = { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC }; static const struct bfd_elf_special_section * diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 3929776..dc0414e 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -1982,7 +1982,7 @@ rl78_offset_for_reloc (bfd * abfd, } } -struct { +const struct { int prefix; /* or -1 for "no prefix" */ int insn; /* or -1 for "end of list" */ int insn_for_saddr; /* or -1 for "no alternative" */ diff --git a/bfd/elf32-z80.c b/bfd/elf32-z80.c index 89089f5..b27f7af 100644 --- a/bfd/elf32-z80.c +++ b/bfd/elf32-z80.c @@ -30,7 +30,7 @@ /* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */ #define OCTETS_PER_BYTE(ABFD, SEC) 1 -typedef struct { +typedef const struct { bfd_reloc_code_real_type r_type; reloc_howto_type howto; } bfd_howto_type; diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 84dba22..f38304a 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -825,11 +825,11 @@ extern FILE *_bfd_real_fopen /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ -extern const bfd_target * const *bfd_target_vector ATTRIBUTE_HIDDEN; +extern const bfd_target *const *const bfd_target_vector ATTRIBUTE_HIDDEN; extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN; /* List of associated target vectors. */ -extern const bfd_target * const *bfd_associated_vector ATTRIBUTE_HIDDEN; +extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN; /* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 74d7e41..6384922 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -830,11 +830,11 @@ extern FILE *_bfd_real_fopen /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ -extern const bfd_target * const *bfd_target_vector ATTRIBUTE_HIDDEN; +extern const bfd_target *const *const bfd_target_vector ATTRIBUTE_HIDDEN; extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN; /* List of associated target vectors. */ -extern const bfd_target * const *bfd_associated_vector ATTRIBUTE_HIDDEN; +extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN; /* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ diff --git a/bfd/targets.c b/bfd/targets.c index b188009..8ae5c48 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1405,7 +1405,7 @@ static const bfd_target * const _bfd_target_vector[] = NULL /* end of list marker */ }; -const bfd_target * const *bfd_target_vector = _bfd_target_vector; +const bfd_target *const *const bfd_target_vector = _bfd_target_vector; /* bfd_default_vector[0] contains either the address of the default vector, if there is one, or zero if there isn't. */ @@ -1420,13 +1420,13 @@ const bfd_target *bfd_default_vector[] = { /* bfd_associated_vector[] contains the associated target vectors used to reduce the ambiguity in bfd_check_format_matches. */ -static const bfd_target *_bfd_associated_vector[] = { +static const bfd_target *const _bfd_associated_vector[] = { #ifdef ASSOCIATED_VECS ASSOCIATED_VECS, #endif NULL }; -const bfd_target * const *bfd_associated_vector = _bfd_associated_vector; +const bfd_target *const *const bfd_associated_vector = _bfd_associated_vector; /* When there is an ambiguous match, bfd_check_format_matches puts the names of the matching targets in an array. This variable is the maximum diff --git a/include/ChangeLog b/include/ChangeLog index 9c19b87..24f1688 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2020-12-18 Alan Modra <amodra@gmail.com> + + * opcode/arc-attrs.h (CONFLICT_LIST): Make const. + 2020-12-16 Alan Modra <amodra@gmail.com> * bfdlink.h (struct bfd_link_info): Add maxpagesize and diff --git a/include/opcode/arc-attrs.h b/include/opcode/arc-attrs.h index 5162db0..c12470f 100644 --- a/include/opcode/arc-attrs.h +++ b/include/opcode/arc-attrs.h @@ -58,7 +58,7 @@ const struct feature_type #endif /* A table with conflicting features. */ -unsigned CONFLICT_LIST [] = { +const unsigned CONFLICT_LIST [] = { NPS400 | SPX, NPS400 | DPX, DPX | DPA, |