opcodes: tic54x: namespace exported variables

The tic54x exports some fairly generic variable names that can
conflict with programs that use them, so put proper tic54x_
prefixes on all of them.
This commit is contained in:
Mike Frysinger 2021-01-16 01:00:45 -05:00
parent 3d4aae4860
commit bfd428bc12
7 changed files with 69 additions and 26 deletions

View File

@ -1,3 +1,11 @@
2021-02-08 Mike Frysinger <vapier@gentoo.org>
* config/tc-tic54x (tic54x_mmregs): Rename to ...
(tic54x_register_mmregs): ... this. Change mmregs to tic54x_mmregs.
(md_pseudo_table): Change tic54x_mmregs to tic54x_register_mmregs.
(md_begin): Add tic54x_ prefix to regs, mmregs, condition_codes,
cc2_codes, cc3_codes, status_bits, and misc_symbols.
2021-02-08 Nick Clifton <nickc@redhat.com>
PR 27355

View File

@ -2007,13 +2007,13 @@ tic54x_label (int ignored ATTRIBUTE_UNUSED)
absolute local symbols. */
static void
tic54x_mmregs (int ignored ATTRIBUTE_UNUSED)
tic54x_register_mmregs (int ignored ATTRIBUTE_UNUSED)
{
tic54x_symbol *sym;
const tic54x_symbol *sym;
ILLEGAL_WITHIN_STRUCT ();
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
for (sym = tic54x_mmregs; sym->name; sym++)
{
symbolS *symbolP = symbol_new (sym->name, absolute_section,
&zero_address_frag, sym->value);
@ -2421,7 +2421,7 @@ const pseudo_typeS md_pseudo_table[] =
{ "mlib" , tic54x_mlib , 0 },
{ "mlist" , s_ignore , 0 },
{ "mnolist" , s_ignore , 0 },
{ "mmregs" , tic54x_mmregs , 0 },
{ "mmregs" , tic54x_register_mmregs , 0 },
{ "newblock" , tic54x_clear_local_labels, 0 },
{ "option" , s_ignore , 0 },
{ "p2align" , tic54x_p2align , 0 },
@ -2965,10 +2965,10 @@ void
md_begin (void)
{
insn_template *tm;
tic54x_symbol *sym;
const tic54x_symbol *sym;
const subsym_proc_entry *subsym_proc;
const math_proc_entry *math_proc;
char **symname;
const char **symname;
char *TIC54X_DIR = getenv ("TIC54X_DIR");
char *A_DIR = TIC54X_DIR ? TIC54X_DIR : getenv ("A_DIR");
@ -3000,7 +3000,7 @@ md_begin (void)
str_hash_insert (parop_hash, tm->name, tm, 0);
reg_hash = str_htab_create ();
for (sym = (tic54x_symbol *) regs; sym->name; sym++)
for (sym = tic54x_regs; sym->name; sym++)
{
/* Add basic registers to the symbol table. */
symbolS *symbolP = symbol_new (sym->name, absolute_section,
@ -3009,30 +3009,30 @@ md_begin (void)
symbol_table_insert (symbolP);
str_hash_insert (reg_hash, sym->name, sym, 0);
}
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
for (sym = tic54x_mmregs; sym->name; sym++)
str_hash_insert (reg_hash, sym->name, sym, 0);
mmreg_hash = str_htab_create ();
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
for (sym = tic54x_mmregs; sym->name; sym++)
str_hash_insert (mmreg_hash, sym->name, sym, 0);
cc_hash = str_htab_create ();
for (sym = (tic54x_symbol *) condition_codes; sym->name; sym++)
for (sym = tic54x_condition_codes; sym->name; sym++)
str_hash_insert (cc_hash, sym->name, sym, 0);
cc2_hash = str_htab_create ();
for (sym = (tic54x_symbol *) cc2_codes; sym->name; sym++)
for (sym = tic54x_cc2_codes; sym->name; sym++)
str_hash_insert (cc2_hash, sym->name, sym, 0);
cc3_hash = str_htab_create ();
for (sym = (tic54x_symbol *) cc3_codes; sym->name; sym++)
for (sym = tic54x_cc3_codes; sym->name; sym++)
str_hash_insert (cc3_hash, sym->name, sym, 0);
sbit_hash = str_htab_create ();
for (sym = (tic54x_symbol *) status_bits; sym->name; sym++)
for (sym = tic54x_status_bits; sym->name; sym++)
str_hash_insert (sbit_hash, sym->name, sym, 0);
misc_symbol_hash = str_htab_create ();
for (symname = (char **) misc_symbols; *symname; symname++)
for (symname = tic54x_misc_symbols; *symname; symname++)
str_hash_insert (misc_symbol_hash, *symname, *symname, 0);
/* Only the base substitution table and local label table are initialized;

View File

@ -1,3 +1,20 @@
2021-02-08 Mike Frysinger <vapier@gentoo.org>
* opcode/tic54x.h (mmregs): Rename to ...
(tic54x_mmregs): ... this.
(regs): Rename to ...
(tic54x_regs): ... this.
(condition_codes): Rename to ...
(tic54x_condition_codes): ... this.
(cc2_codes): Rename to ...
(tic54x_cc2_codes): ... this.
(status_bits): Rename to ...
(tic54x_status_bits): ... this.
(cc3_codes): Rename to ...
(tic54x_cc3_codes): ... this.
(misc_symbols): Rename to ...
(tic54x_misc_symbols): ... this.
2021-02-05 Nelson Chu <nelson.chu@sifive.com>
PR 27348

View File

@ -152,10 +152,10 @@ typedef struct _template
extern const insn_template tic54x_unknown_opcode;
extern const insn_template tic54x_optab[];
extern const insn_template tic54x_paroptab[];
extern const tic54x_symbol mmregs[], regs[];
extern const tic54x_symbol condition_codes[], cc2_codes[], status_bits[];
extern const tic54x_symbol cc3_codes[];
extern const char *misc_symbols[];
extern const tic54x_symbol tic54x_mmregs[], tic54x_regs[];
extern const tic54x_symbol tic54x_condition_codes[], tic54x_cc2_codes[];
extern const tic54x_symbol tic54x_status_bits[], tic54x_cc3_codes[];
extern const char *tic54x_misc_symbols[];
struct disassemble_info;
extern const insn_template* tic54x_get_insn (struct disassemble_info *,
bfd_vma, unsigned short, int *);

View File

@ -1,3 +1,21 @@
2021-02-08 Mike Frysinger <vapier@gentoo.org>
* tic54x-dis.c (sprint_mmr): Change to tic54x_mmregs.
* tic54x-opc.c (regs): Rename to ...
(tic54x_regs): ... this.
(mmregs): Rename to ...
(tic54x_mmregs): ... this.
(condition_codes): Rename to ...
(tic54x_condition_codes): ... this.
(cc2_codes): Rename to ...
(tic54x_cc2_codes): ... this.
(cc3_codes): Rename to ...
(tic54x_cc3_codes): ... this.
(status_bits): Rename to ...
(tic54x_status_bits): ... this.
(misc_symbols): Rename to ...
(tic54x_misc_symbols): ... this.
2021-02-04 Nelson Chu <nelson.chu@sifive.com>
* riscv-opc.c (MASK_RVB_IMM): Removed.

View File

@ -529,7 +529,7 @@ sprint_mmr (disassemble_info *info ATTRIBUTE_UNUSED,
char buf[],
int mmr)
{
tic54x_symbol *reg = (tic54x_symbol *) mmregs;
const tic54x_symbol *reg = tic54x_mmregs;
while (reg->name != NULL)
{
if (mmr == reg->value)

View File

@ -24,7 +24,7 @@
#include "opcode/tic54x.h"
/* these are the only register names not found in mmregs */
const tic54x_symbol regs[] = {
const tic54x_symbol tic54x_regs[] = {
{ "AR0", 16 }, { "ar0", 16 },
{ "AR1", 17 }, { "ar1", 17 },
{ "AR2", 18 }, { "ar2", 18 },
@ -38,7 +38,7 @@ const tic54x_symbol regs[] = {
/* status bits, MM registers, condition codes, etc */
/* some symbols are only valid for certain chips... */
const tic54x_symbol mmregs[] = {
const tic54x_symbol tic54x_mmregs[] = {
{ "IMR", 0 }, { "imr", 0 },
{ "IFR", 1 }, { "ifr", 1 },
{ "ST0", 6 }, { "st0", 6 },
@ -111,7 +111,7 @@ const tic54x_symbol mmregs[] = {
{ NULL, 0},
};
const tic54x_symbol condition_codes[] = {
const tic54x_symbol tic54x_condition_codes[] = {
/* condition codes */
{ "UNC", 0 }, { "unc", 0 },
#define CC1 0x40
@ -155,7 +155,7 @@ const tic54x_symbol condition_codes[] = {
{ NULL, 0 }
};
const tic54x_symbol cc2_codes[] = {
const tic54x_symbol tic54x_cc2_codes[] = {
{ "UNC", 0 }, { "unc", 0 },
{ "AEQ", 5 }, { "aeq", 5 },
{ "ANEQ", 4 }, { "aneq", 4 },
@ -172,7 +172,7 @@ const tic54x_symbol cc2_codes[] = {
{ NULL, 0 },
};
const tic54x_symbol cc3_codes[] = {
const tic54x_symbol tic54x_cc3_codes[] = {
{ "EQ", 0x0000 }, { "eq", 0x0000 },
{ "LT", 0x0100 }, { "lt", 0x0100 },
{ "GT", 0x0200 }, { "gt", 0x0200 },
@ -189,7 +189,7 @@ const tic54x_symbol cc3_codes[] = {
};
/* FIXME -- also allow decimal digits */
const tic54x_symbol status_bits[] = {
const tic54x_symbol tic54x_status_bits[] = {
/* status register 0 */
{ "TC", 12 }, { "tc", 12 },
{ "C", 11 }, { "c", 11 },
@ -209,7 +209,7 @@ const tic54x_symbol status_bits[] = {
{ NULL, 0 },
};
const char *misc_symbols[] = {
const char *tic54x_misc_symbols[] = {
"ARP", "arp",
"DP", "dp",
"ASM", "asm",