* [PATCH] opcodes: tic54x: namespace exported variables
@ 2021-01-16 6:22 Mike Frysinger
2021-01-30 6:12 ` Mike Frysinger
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2021-01-16 6:22 UTC (permalink / raw)
To: binutils; +Cc: twall
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.
include/:
* 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.
gas/:
* 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.
opcodes/:
* 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.
---
gas/config/tc-tic54x.c | 28 ++++++++++++++--------------
include/opcode/tic54x.h | 8 ++++----
opcodes/tic54x-dis.c | 2 +-
opcodes/tic54x-opc.c | 14 +++++++-------
4 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index 5a6bc8aa7dc6..da2c755946c6 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -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;
diff --git a/include/opcode/tic54x.h b/include/opcode/tic54x.h
index 8e0dd7e75902..4567ca89cc0e 100644
--- a/include/opcode/tic54x.h
+++ b/include/opcode/tic54x.h
@@ -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 *);
diff --git a/opcodes/tic54x-dis.c b/opcodes/tic54x-dis.c
index 85309eaded9e..5bf9a58f8eb7 100644
--- a/opcodes/tic54x-dis.c
+++ b/opcodes/tic54x-dis.c
@@ -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)
diff --git a/opcodes/tic54x-opc.c b/opcodes/tic54x-opc.c
index 6ed2cb8d8874..411460c07edf 100644
--- a/opcodes/tic54x-opc.c
+++ b/opcodes/tic54x-opc.c
@@ -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",
--
2.28.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] opcodes: tic54x: namespace exported variables
2021-01-16 6:22 [PATCH] opcodes: tic54x: namespace exported variables Mike Frysinger
@ 2021-01-30 6:12 ` Mike Frysinger
2021-02-08 17:01 ` Nick Clifton
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2021-01-30 6:12 UTC (permalink / raw)
To: binutils, twall
ping ...
On 16 Jan 2021 01:22, Mike Frysinger via Binutils wrote:
> 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.
>
> include/:
>
> * 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.
>
> gas/:
>
> * 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.
>
> opcodes/:
>
> * 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.
> ---
> gas/config/tc-tic54x.c | 28 ++++++++++++++--------------
> include/opcode/tic54x.h | 8 ++++----
> opcodes/tic54x-dis.c | 2 +-
> opcodes/tic54x-opc.c | 14 +++++++-------
> 4 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
> index 5a6bc8aa7dc6..da2c755946c6 100644
> --- a/gas/config/tc-tic54x.c
> +++ b/gas/config/tc-tic54x.c
> @@ -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;
> diff --git a/include/opcode/tic54x.h b/include/opcode/tic54x.h
> index 8e0dd7e75902..4567ca89cc0e 100644
> --- a/include/opcode/tic54x.h
> +++ b/include/opcode/tic54x.h
> @@ -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 *);
> diff --git a/opcodes/tic54x-dis.c b/opcodes/tic54x-dis.c
> index 85309eaded9e..5bf9a58f8eb7 100644
> --- a/opcodes/tic54x-dis.c
> +++ b/opcodes/tic54x-dis.c
> @@ -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)
> diff --git a/opcodes/tic54x-opc.c b/opcodes/tic54x-opc.c
> index 6ed2cb8d8874..411460c07edf 100644
> --- a/opcodes/tic54x-opc.c
> +++ b/opcodes/tic54x-opc.c
> @@ -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",
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] opcodes: tic54x: namespace exported variables
2021-01-30 6:12 ` Mike Frysinger
@ 2021-02-08 17:01 ` Nick Clifton
0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2021-02-08 17:01 UTC (permalink / raw)
To: binutils, twall
Hi Mike,
> ping ...
pong - please commit.
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-08 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-16 6:22 [PATCH] opcodes: tic54x: namespace exported variables Mike Frysinger
2021-01-30 6:12 ` Mike Frysinger
2021-02-08 17:01 ` Nick Clifton
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).