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.
This commit is contained in:
Alan Modra 2020-12-17 08:33:39 +10:30
parent 7f3a18cfb5
commit bd38246a45
13 changed files with 38 additions and 18 deletions

View File

@ -1,3 +1,19 @@
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.

View File

@ -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;

View File

@ -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},

View File

@ -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;

View File

@ -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);

View File

@ -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 *

View File

@ -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" */

View File

@ -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;

View File

@ -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. */

View File

@ -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. */

View File

@ -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

View File

@ -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

View File

@ -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,