]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gas/config/tc-sparc.c
gas: sparc: fix collision of registers and pseudo-ops.
authorJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 17 Jun 2016 09:13:30 +0000 (02:13 -0700)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 17 Jun 2016 09:13:30 +0000 (02:13 -0700)
commit8b8c7c9f49992750f66f81b4601d593a3858d98c
tree2519ddafa4cb27bc36cdb9f6effcee87546905a9
parent4f26fb3a1b1369a044ac642d1e82bf6fc6dfa9d9
gas: sparc: fix collision of registers and pseudo-ops.

The current sparc assembler breaks when the name of an ancillary-state
register, privileged register or hyperprivileged register has a
%-pseudo-operation name as a prefix.  For example, %hmcdper and %hm(),
or %hintp and %hi().

This patch fixes it by introducing a new table `perc_table' (for
%-table) that contains an entry for every %name supported by the
assembler, other than the general registers.  This table is used to
detect name collisions when the assembler tries to detect a %-pseudo-op.

This patch also fixes a related bug, making sure that v9a_asr_table and
hpriv_reg_table are sorted in reverse lexicographic order, as otherwise
the search code may fail.

gas/ChangeLog:

2016-06-17  Jose E. Marchesi  <jose.marchesi@oracle.com>

* config/tc-sparc.c (priv_reg_table): Use NULL instead of the
empty string to mark the end of the array.
(hpriv_reg_table): Likewise.
(v9a_asr_table): Likewise.
(cmp_reg_entry): Handle entries with NULL names.
(F_POP_V9): Define.
(F_POP_PCREL): Likewise.
(F_POP_TLS_CALL): Likewise.
(F_POP_POSTFIX): Likewise.
(struct pop_entry): New type.
(pop_table): New variable.
(enum pop_entry_type): New type.
(struct perc_entry): Likewise.
(NUM_PERC_ENTRIES): Define.
(perc_table): New variable.
(cmp_perc_entry): New function.
(md_begin): Sort hpriv_reg_table and v9a_asr_table, and initialize
perc_table.
(sparc_ip): Handle entries with NULL names in priv_reg_table,
hpriv_reg_table and v9a_asr_table.  Use perc_table to handle
%-pseudo-ops.
gas/ChangeLog
gas/config/tc-sparc.c