diff options
author | Jan Beulich <jbeulich@suse.com> | 2022-12-12 08:46:47 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2022-12-12 08:46:47 +0100 |
commit | 99f0fb12d544c9489804714f89e7738e60d2ea5d (patch) | |
tree | c979cebf7f24ddaefd56c8a5282c1391deda8832 | |
parent | b35abeab8d8d682298f5d53aa6b0baba3fcdcee7 (diff) | |
download | binutils-gdb-99f0fb12d544c9489804714f89e7738e60d2ea5d.tar.gz |
x86: instantiate i386_{op,reg}tab[] in gas instead of in libopcodes
Unlike many other architectures, x86 does not share an opcode table
between assembly and disassembly. Any consumer of libopcodes would only
ever access one of the two. Since gas is the only consumer of the
assembly data, move it there. While doing so mark respective entities
"static" in i386-gen (we may want to do away with i386_regtab_size
altogether).
This also shrinks the number of relocations to be processed for
libopcodes.so by about 30%.
-rw-r--r-- | gas/config/tc-i386.c | 2 | ||||
-rw-r--r-- | opcodes/i386-gen.c | 6 | ||||
-rw-r--r-- | opcodes/i386-opc.c | 1 | ||||
-rw-r--r-- | opcodes/i386-opc.h | 7 | ||||
-rw-r--r-- | opcodes/i386-tbl.h | 6 |
5 files changed, 9 insertions, 13 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index d7bab7d77aa..e68ff2fafbf 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2961,6 +2961,8 @@ i386_mach (void) as_fatal (_("unknown architecture")); } +#include "opcodes/i386-tbl.h" + void md_begin (void) { diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c index ee23c2dd01e..5551008a50a 100644 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1718,7 +1718,7 @@ process_i386_opcodes (FILE *table) xcalloc, free); fprintf (table, "\n/* i386 opcode table. */\n\n"); - fprintf (table, "const insn_template i386_optab[] =\n{\n"); + fprintf (table, "static const insn_template i386_optab[] =\n{\n"); /* Put everything on opcode array. */ while (!feof (fp)) @@ -1848,7 +1848,7 @@ process_i386_registers (FILE *table) xstrerror (errno)); fprintf (table, "\n/* i386 register table. */\n\n"); - fprintf (table, "const reg_entry i386_regtab[] =\n{\n"); + fprintf (table, "static const reg_entry i386_regtab[] =\n{\n"); while (!feof (fp)) { @@ -1911,7 +1911,7 @@ process_i386_registers (FILE *table) fprintf (table, "};\n"); - fprintf (table, "\nconst unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);\n"); + fprintf (table, "\nstatic const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);\n"); } static void diff --git a/opcodes/i386-opc.c b/opcodes/i386-opc.c index 729c22932b1..4f0c948f479 100644 --- a/opcodes/i386-opc.c +++ b/opcodes/i386-opc.c @@ -21,4 +21,3 @@ #include "sysdep.h" #include "libiberty.h" #include "i386-opc.h" -#include "i386-tbl.h" diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h index 215a72d18e1..59ba23fecd5 100644 --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -918,7 +918,7 @@ typedef union i386_operand_type typedef struct insn_template { /* instruction name sans width suffix ("mov" for movl insns) */ - char *name; + const char *name; /* Bitfield arrangement is such that individual fields can be easily extracted (in native builds at least) - either by at most a masking @@ -984,8 +984,6 @@ typedef struct insn_template } insn_template; -extern const insn_template i386_optab[]; - /* these are for register name --> number & type hash lookup */ typedef struct { @@ -1005,6 +1003,3 @@ typedef struct #define Dw2Inval (-1) } reg_entry; - -extern const reg_entry i386_regtab[]; -extern const unsigned int i386_regtab_size; diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h index 82861459eef..ff84e222ffe 100644 --- a/opcodes/i386-tbl.h +++ b/opcodes/i386-tbl.h @@ -20,7 +20,7 @@ /* i386 opcode table. */ -const insn_template i386_optab[] = +static const insn_template i386_optab[] = { { "mov", 0xa0, 2, None, { 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, @@ -59853,7 +59853,7 @@ const insn_template i386_optab[] = /* i386 register table. */ -const reg_entry i386_regtab[] = +static const reg_entry i386_regtab[] = { { "al", { { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, @@ -61009,4 +61009,4 @@ const reg_entry i386_regtab[] = 0, 0, { 39, 64 } }, }; -const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab); +static const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab); |