aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf.c4
-rw-r--r--bfd/elf32-arm.c35
-rw-r--r--bfd/elflink.c4
-rw-r--r--bfd/elfxx-riscv.c26
5 files changed, 36 insertions, 35 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index b791623..f24342c 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2632,7 +2632,7 @@ extern bool _bfd_elf_link_output_relocs
struct elf_link_hash_entry **);
extern void _bfd_elf_link_add_glibc_version_dependency
- (struct elf_find_verdep_info *, const char *[]);
+ (struct elf_find_verdep_info *, const char *const []);
extern void _bfd_elf_link_add_dt_relr_dependency
(struct elf_find_verdep_info *);
diff --git a/bfd/elf.c b/bfd/elf.c
index dfa04c9..1b2e331 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10948,7 +10948,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
type = bfd_get_32 (abfd, note->descdata);
- struct
+ static const struct
{
const char *type_name;
unsigned long min_size;
@@ -13345,7 +13345,7 @@ elf_parse_notes (bfd *abfd, char *buf, size_t size, file_ptr offset,
case bfd_core:
{
#define GROKER_ELEMENT(S,F) {S, sizeof (S) - 1, F}
- struct
+ static const struct
{
const char * string;
size_t len;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index b5d1866..df60430 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12542,7 +12542,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
case R_ARM_THM_ALU_ABS_G2_NC:
case R_ARM_THM_ALU_ABS_G3_NC:
{
- const int shift_array[4] = {0, 8, 16, 24};
+ static const int shift_array[4] = {0, 8, 16, 24};
bfd_vma insn = bfd_get_16 (input_bfd, hit_data);
bfd_vma addr = value;
int shift = shift_array[r_type - R_ARM_THM_ALU_ABS_G0_NC];
@@ -14061,11 +14061,12 @@ set_secondary_compatible_arch (bfd *abfd, int arch)
static int
tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
- int newtag, int secondary_compat, const char* name_table[])
+ int newtag, int secondary_compat,
+ const char *const name_table[])
{
#define T(X) TAG_CPU_ARCH_##X
int tagl, tagh, result;
- const int v6t2[] =
+ static const int v6t2[] =
{
T(V6T2), /* PRE_V4. */
T(V6T2), /* V4. */
@@ -14077,7 +14078,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V7), /* V6KZ. */
T(V6T2) /* V6T2. */
};
- const int v6k[] =
+ static const int v6k[] =
{
T(V6K), /* PRE_V4. */
T(V6K), /* V4. */
@@ -14090,7 +14091,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V7), /* V6T2. */
T(V6K) /* V6K. */
};
- const int v7[] =
+ static const int v7[] =
{
T(V7), /* PRE_V4. */
T(V7), /* V4. */
@@ -14104,7 +14105,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V7), /* V6K. */
T(V7) /* V7. */
};
- const int v6_m[] =
+ static const int v6_m[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14119,7 +14120,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V7), /* V7. */
T(V6_M) /* V6_M. */
};
- const int v6s_m[] =
+ static const int v6s_m[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14135,7 +14136,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V6S_M), /* V6_M. */
T(V6S_M) /* V6S_M. */
};
- const int v7e_m[] =
+ static const int v7e_m[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14152,7 +14153,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V7E_M), /* V6S_M. */
T(V7E_M) /* V7E_M. */
};
- const int v8[] =
+ static const int v8[] =
{
T(V8), /* PRE_V4. */
T(V8), /* V4. */
@@ -14177,7 +14178,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V8), /* V8.3. */
T(V8), /* V8.1-M.MAIN. */
};
- const int v8r[] =
+ static const int v8r[] =
{
T(V8R), /* PRE_V4. */
T(V8R), /* V4. */
@@ -14196,7 +14197,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V8), /* V8. */
T(V8R), /* V8R. */
};
- const int v8m_baseline[] =
+ static const int v8m_baseline[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14216,7 +14217,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
-1, /* V8R. */
T(V8M_BASE) /* V8-M BASELINE. */
};
- const int v8m_mainline[] =
+ static const int v8m_mainline[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14237,7 +14238,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V8M_MAIN), /* V8-M BASELINE. */
T(V8M_MAIN) /* V8-M MAINLINE. */
};
- const int v8_1m_mainline[] =
+ static const int v8_1m_mainline[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14262,7 +14263,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
-1, /* Unused (20). */
T(V8_1M_MAIN) /* V8.1-M MAINLINE. */
};
- const int v9[] =
+ static const int v9[] =
{
T(V9), /* PRE_V4. */
T(V9), /* V4. */
@@ -14288,7 +14289,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V9), /* V8.1-M.MAIN. */
T(V9), /* V9. */
};
- const int v4t_plus_v6_m[] =
+ static const int v4t_plus_v6_m[] =
{
-1, /* PRE_V4. */
-1, /* V4. */
@@ -14315,7 +14316,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V9), /* V9. */
T(V4T_PLUS_V6_M) /* V4T plus V6_M. */
};
- const int *comb[] =
+ static const int *const comb[] =
{
v6t2,
v6k,
@@ -14539,7 +14540,7 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
int secondary_compat = -1, secondary_compat_out = -1;
unsigned int saved_out_attr = out_attr[i].i;
int arch_attr;
- static const char *name_table[] =
+ static const char *const name_table[] =
{
/* These aren't real CPU names, but we can't guess
that from the architecture version alone. */
diff --git a/bfd/elflink.c b/bfd/elflink.c
index cdd58b2..7b03754 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2380,7 +2380,7 @@ elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo,
void
_bfd_elf_link_add_glibc_version_dependency
(struct elf_find_verdep_info *rinfo,
- const char *version_dep[])
+ const char *const version_dep[])
{
Elf_Internal_Verneed *t = NULL;
int glibc_minor_base = INT_MAX;
@@ -2405,7 +2405,7 @@ _bfd_elf_link_add_dt_relr_dependency (struct elf_find_verdep_info *rinfo)
{
if (rinfo->info->enable_dt_relr)
{
- const char *version[] =
+ static const char *const version[] =
{
"GLIBC_ABI_DT_RELR",
NULL
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 1200032..3567573 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -43,7 +43,7 @@ static bfd_reloc_status_type riscv_elf_ignore_reloc
/* The relocation table used for SHT_RELA sections. */
-static reloc_howto_type howto_table[] =
+static const reloc_howto_type howto_table[] =
{
/* No relocation. */
HOWTO (R_RISCV_NONE, /* type */
@@ -879,7 +879,7 @@ static reloc_howto_type howto_table[] =
false) /* pcrel_offset */
};
-static reloc_howto_type howto_table_internal[] =
+static const reloc_howto_type howto_table_internal[] =
{
/* R_RISCV_DELETE. */
EMPTY_HOWTO (0),
@@ -1204,7 +1204,7 @@ struct riscv_implicit_subset
const riscv_subset_t *);
};
/* Please added in order since this table is only run once time. */
-static struct riscv_implicit_subset riscv_implicit_subsets[] =
+static const struct riscv_implicit_subset riscv_implicit_subsets[] =
{
{"g", "+i,+m,+a,+f,+d,+zicsr,+zifencei", check_implicit_always},
{"e", "+i", check_implicit_always},
@@ -1336,7 +1336,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
};
/* This table records the mapping form RISC-V Profiles into march string. */
-static struct riscv_profiles riscv_profiles_table[] =
+static const struct riscv_profiles riscv_profiles_table[] =
{
/* RVI20U only contains the base extension 'i' as mandatory extension. */
{"rvi20u64", "rv64i"},
@@ -1408,7 +1408,7 @@ struct riscv_supported_ext
/* The standard extensions must be added in canonical order. */
-static struct riscv_supported_ext riscv_supported_std_ext[] =
+static const struct riscv_supported_ext riscv_supported_std_ext[] =
{
{"e", ISA_SPEC_CLASS_20191213, 1, 9, 0 },
{"e", ISA_SPEC_CLASS_20190608, 1, 9, 0 },
@@ -1443,7 +1443,7 @@ static struct riscv_supported_ext riscv_supported_std_ext[] =
{NULL, 0, 0, 0, 0}
};
-static struct riscv_supported_ext riscv_supported_std_z_ext[] =
+static const struct riscv_supported_ext riscv_supported_std_z_ext[] =
{
{"zic64b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"ziccamoa", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
@@ -1550,7 +1550,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
{NULL, 0, 0, 0, 0}
};
-static struct riscv_supported_ext riscv_supported_std_s_ext[] =
+static const struct riscv_supported_ext riscv_supported_std_s_ext[] =
{
{"sha", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"shcounterenw", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
@@ -1597,12 +1597,12 @@ static struct riscv_supported_ext riscv_supported_std_s_ext[] =
{NULL, 0, 0, 0, 0}
};
-static struct riscv_supported_ext riscv_supported_std_zxm_ext[] =
+static const struct riscv_supported_ext riscv_supported_std_zxm_ext[] =
{
{NULL, 0, 0, 0, 0}
};
-static struct riscv_supported_ext riscv_supported_vendor_x_ext[] =
+static const struct riscv_supported_ext riscv_supported_vendor_x_ext[] =
{
{"xcvalu", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"xcvbi", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
@@ -1639,7 +1639,7 @@ static struct riscv_supported_ext riscv_supported_vendor_x_ext[] =
{NULL, 0, 0, 0, 0}
};
-const struct riscv_supported_ext *riscv_all_supported_ext[] =
+static const struct riscv_supported_ext *riscv_all_supported_ext[] =
{
riscv_supported_std_ext,
riscv_supported_std_z_ext,
@@ -1701,7 +1701,7 @@ riscv_get_prefix_class (const char *arch)
static bool
riscv_known_prefixed_ext (const char *ext,
- struct riscv_supported_ext *known_exts)
+ const struct riscv_supported_ext *known_exts)
{
size_t i;
for (i = 0; known_exts[i].name != NULL; ++i)
@@ -1894,7 +1894,7 @@ riscv_get_default_ext_version (enum riscv_spec_class *default_isa_spec,
|| *default_isa_spec == ISA_SPEC_CLASS_NONE)
return;
- struct riscv_supported_ext *table = NULL;
+ const struct riscv_supported_ext *table = NULL;
enum riscv_prefix_ext_class class = riscv_get_prefix_class (name);
switch (class)
{
@@ -2185,7 +2185,7 @@ riscv_update_subset1 (riscv_parse_subset_t *, riscv_subset_t *, const char *);
static void
riscv_parse_add_implicit_subsets (riscv_parse_subset_t *rps)
{
- struct riscv_implicit_subset *t = riscv_implicit_subsets;
+ const struct riscv_implicit_subset *t = riscv_implicit_subsets;
for (; t->ext; t++)
{
riscv_subset_t *subset = NULL;