opcodes: constify aarch64_opcode_tables

Message ID 20210627054548.29262-1-vapier@gentoo.org
State New
Headers show
Series
  • opcodes: constify aarch64_opcode_tables
Related show

Commit Message

Libor Bukata via Binutils June 27, 2021, 5:45 a.m.
This table is huge (~350k), so stop putting it into writable .data
since it's only const data.
---
 gas/config/tc-aarch64.c  | 6 +++---
 include/opcode/aarch64.h | 2 +-
 opcodes/aarch64-gen.c    | 2 +-
 opcodes/aarch64-tbl.h    | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.31.1

Comments

Libor Bukata via Binutils July 1, 2021, 10:05 a.m. | #1
Hi Mike,

> This table is huge (~350k), so stop putting it into writable .data

> since it's only const data.


Patch approved - please apply, with ChangeLog entries.  (We still need
them until the 2,37 branch is cut).

Cheers
   Nick

Patch

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 9ff2d6803dd1..2eaad63a9fa3 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -5214,7 +5214,7 @@  output_inst (struct aarch64_inst *new_inst)
 
 struct templates
 {
-  aarch64_opcode *opcode;
+  const aarch64_opcode *opcode;
   struct templates *next;
 };
 
@@ -7272,7 +7272,7 @@  md_assemble (char *str)
 {
   char *p = str;
   templates *template;
-  aarch64_opcode *opcode;
+  const aarch64_opcode *opcode;
   aarch64_inst *inst_base;
   unsigned saved_cond;
 
@@ -8768,7 +8768,7 @@  sysreg_hash_insert (htab_t table, const char *key, void *value)
 static void
 fill_instruction_hash_table (void)
 {
-  aarch64_opcode *opcode = aarch64_opcode_table;
+  const aarch64_opcode *opcode = aarch64_opcode_table;
 
   while (opcode->name != NULL)
     {
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h
index f43df79d7c5a..2bbd593c36ec 100644
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -826,7 +826,7 @@  struct aarch64_opcode
 typedef struct aarch64_opcode aarch64_opcode;
 
 /* Table describing all the AArch64 opcodes.  */
-extern aarch64_opcode aarch64_opcode_table[];
+extern const aarch64_opcode aarch64_opcode_table[];
 
 /* Opcode flags.  */
 #define F_ALIAS (1 << 0)
diff --git a/opcodes/aarch64-gen.c b/opcodes/aarch64-gen.c
index 356c5efcf3c3..d0581bcf6e1b 100644
--- a/opcodes/aarch64-gen.c
+++ b/opcodes/aarch64-gen.c
@@ -84,7 +84,7 @@  new_opcode_node (void)
    'aarch64_opcode_table' hard-coded in, e.g. print_find_next_opcode;
    therefore some amount of work needs to be done if the full support
    for multiple tables needs to be enabled.  */
-static const struct aarch64_opcode *aarch64_opcode_tables[] =
+static const struct aarch64_opcode * const aarch64_opcode_tables[] =
 {aarch64_opcode_table};
 
 /* Use top 2 bits to indiate which table.  */
diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h
index 4192e54d1883..17ea851c7137 100644
--- a/opcodes/aarch64-tbl.h
+++ b/opcodes/aarch64-tbl.h
@@ -2584,7 +2584,7 @@  static const aarch64_feature_set aarch64_feature_flagm =
 #define FLAGM_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \
   { NAME, OPCODE, MASK, CLASS, 0, FLAGM, OPS, QUALS, FLAGS, 0, 0, NULL }
 
-struct aarch64_opcode aarch64_opcode_table[] =
+const struct aarch64_opcode aarch64_opcode_table[] =
 {
   /* Add/subtract (with carry).  */
   CORE_INSN ("adc",  0x1a000000, 0x7fe0fc00, addsub_carry, 0, OP3 (Rd, Rn, Rm), QL_I3SAMER, F_SF),