Hi all,
This patch makes locally used symbols static to enable more compiler
optimizations on them. Some of the symbols turned out to not be used
at all so I marked them with ATTRIBUTE_UNUSED (as I wasn't sure if
they were ok to delete).
The symbols have been identified with a pet project of mine:
https://github.com/yugr/Localizer
>From 07b4f05893b7037e68e5d7bdec5ba8e74e50 Mon Sep 17 00:00:00 2001
From: Yury Gribov
Date: Sat, 20 Mar 2021 23:39:15 +0300
Subject: [PATCH] [NFC] Mark locally used symbols as static.
Signed-off-by: Yury Gribov
---
disas/alpha.c | 16 ++--
disas/m68k.c | 78 -
disas/mips.c | 14 ++--
disas/nios2.c | 84 +--
disas/ppc.c | 26 +++---
disas/riscv.c | 2 +-
pc-bios/optionrom/linuxboot_dma.c | 4 +-
scripts/tracetool/format/c.py | 2 +-
target/hexagon/gen_dectree_import.c | 2 +-
target/hexagon/opcodes.c | 2 +-
target/i386/cpu.c | 2 +-
target/s390x/cpu_models.c | 2 +-
.../xtensa/core-dc232b/xtensa-modules.c.inc | 2 +-
.../xtensa/core-dc233c/xtensa-modules.c.inc | 2 +-
target/xtensa/core-de212/xtensa-modules.c.inc | 2 +-
.../core-de233_fpu/xtensa-modules.c.inc | 2 +-
.../xtensa/core-dsp3400/xtensa-modules.c.inc | 2 +-
target/xtensa/core-fsf/xtensa-modules.c.inc | 2 +-
.../xtensa-modules.c.inc | 2 +-
.../core-test_kc705_be/xtensa-modules.c.inc | 2 +-
.../core-test_mmuhifi_c3/xtensa-modules.c.inc | 2 +-
21 files changed, 125 insertions(+), 127 deletions(-)
diff --git a/disas/alpha.c b/disas/alpha.c
index 3db90fa..361a4ed 100644
--- a/disas/alpha.c
+++ b/disas/alpha.c
@@ -56,8 +56,8 @@ struct alpha_opcode
/* The table itself is sorted by major opcode number, and is otherwise
in the order in which the disassembler should consider
instructions. */
-extern const struct alpha_opcode alpha_opcodes[];
-extern const unsigned alpha_num_opcodes;
+static const struct alpha_opcode alpha_opcodes[];
+static const unsigned alpha_num_opcodes;
/* Values defined for the flags field of a struct alpha_opcode. */
@@ -137,8 +137,8 @@ struct alpha_operand
/* Elements in the table are retrieved by indexing with values from
the operands field of the alpha_opcodes table. */
-extern const struct alpha_operand alpha_operands[];
-extern const unsigned alpha_num_operands;
+static const struct alpha_operand alpha_operands[];
+static const unsigned alpha_num_operands;
/* Values defined for the flags field of a struct alpha_operand. */
@@ -293,7 +293,7 @@ static int extract_ev6hwjhint (unsigned, int *);
/* The operands table */
-const struct alpha_operand alpha_operands[] =
+static const struct alpha_operand alpha_operands[] =
{
/* The fields are bits, shift, insert, extract, flags */
/* The zero index is used to indicate end-of-list */
@@ -424,7 +424,7 @@ const struct alpha_operand alpha_operands[] =
insert_ev6hwjhint, extract_ev6hwjhint }
};
-const unsigned alpha_num_operands =
sizeof(alpha_operands)/sizeof(*alpha_operands);
+static ATTRIBUTE_UNUSED const unsigned alpha_num_operands =
sizeof(alpha_operands)/sizeof(*alpha_operands);
/* The RB field when it is the same as the RA field in the same insn.
This operand is marked fake. The insertion function just copies
@@ -706,7 +706,7 @@ extract_ev6hwjhint(unsigned insn, int *invalid
ATTRIBUTE_UNUSED)
that were not assigned to a particular extension.
*/
-const struct alpha_opcode alpha_opcodes[] = {
+static const struct alpha_opcode alpha_opcodes[] = {
{ "halt",SPCD(0x00,0x), BASE, ARG_NONE },
{ "draina", SPCD(0x00,0x0002), BASE, ARG_NONE },
{ "bpt", SPCD(0x00,0x0080), BASE, ARG_NONE },
@@ -1732,7 +1732,7 @@ const struct alpha_opcode alpha_opcodes[] = {
{ "bgt", BRA(0x3F), BASE, ARG_BRA },
};
-const unsigned alpha_num_opcodes =
sizeof(alpha_opcodes)/sizeof(*alpha_opcodes);
+static ATTRIBUTE_UNUSED const unsigned alpha_num_opcodes =
sizeof(alpha_opcodes)/sizeof(*alpha_opcodes);
/* OSF register names. */
diff --git a/disas/m68k.c b/disas/m68k.c
index aefaecf..903d5cf 100644
--- a/disas/m68k.c
+++ b/disas/m68k.c
@@ -95,29 +95,29 @@ struct floatformat
/* floatformats for IEEE single and double, big and little endian. */
-extern const struct floatformat floatformat_ieee_single_big;
-extern const struct floatformat floatformat_ieee_single_little;
-extern const struct floatformat floatformat_ieee_double_big;
-extern const struct floatformat floatformat_ieee_double_little;
+static const struct floatformat floatformat_ieee_single_big;
+static const struct floatformat floatformat_ieee_single_little;
+static const struct floatformat