public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: binutils@sourceware.org
Subject: [PATCH] opcodes: constify aarch64_opcode_tables
Date: Sun, 27 Jun 2021 01:45:48 -0400	[thread overview]
Message-ID: <20210627054548.29262-1-vapier@gentoo.org> (raw)

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(-)

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),
-- 
2.31.1


             reply	other threads:[~2021-06-27  5:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27  5:45 Mike Frysinger [this message]
2021-07-01 10:05 ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210627054548.29262-1-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).