binutils-gdb/include/opcode
Jose E. Marchesi 6884417a0f gas,opcodes: fix hardware capabilities bumping in the sparc assembler.
When the assembler finds an instruction which is part of a higher
opcode architecture it bumps the current opcode architecture.  For
example:

   $ echo "mwait" | as -bump
   {standard input}: Assembler messages:
   {standard input}:1: Warning: architecture bumped from "v6" to "v9m" on "mwait"

However, when two instructions pertaining to the same opcode
architecture but associated to different SPARC hardware capabilities
are found in the input stream, and no GAS architecture is specified in
the command line, the assembler bangs:

   $ echo "mwait; wr %g0,%g1,%mcdper" | as -bump
   {standard input}: Assembler messages:
   {standard input}:1: Warning: architecture bumped from "v6" to "v9m" on "mwait"
   {standard input}:1: Error: Hardware capability "sparc5" not enabled for "wr".

... and it should'nt, as WRMCDPER pertains to the same architecture
level than MWAIT.

This patch fixes this by extending the definition of sparc opcode
architectures to contain a set of hardware capabilities and making the
assembler to take these capabilities into account when updating the
set of allowed hwcaps when an architecture bump is triggered by some
instruction.

This way, hwcaps associated to architecture levels are maintained in
opcodes, while the assembler keeps the flexibiity of defining GAS
architectures including additional hwcaps (like -Asparcfmaf or the
v8plus* variants).

A test covering this failure case is included.

gas/ChangeLog:

2016-11-22  Jose E. Marchesi  <jose.marchesi@oracle.com>

       	* config/tc-sparc.c: Move HWS_* and HWS2_* definitions to
       	opcodes/sparc-opc.c.
       	(sparc_arch): Clarify the new role of the hwcap_allowed and
       	hwcap2_allowed fields.
       	(sparc_arch_table): Remove HWS_* and HWS2_* instances from
       	hwcap_allowed and hwcap2_allowed respectively.
       	(md_parse_option): Include the opcode arch hwcaps when processing
       	-A.
       	(sparc_ip): Use the current opcode arch hwcaps to update
       	hwcap_allowed, as well of the hwcaps of the instruction triggering
       	the bump.
       	* testsuite/gas/sparc/hwcaps-bump.s: New file.
       	* testsuite/gas/sparc/hwcaps-bump.l: Likewise.
       	* testsuite/gas/sparc/sparc.exp (gas_64_check): Run tests in
       	hwcaps-bump.

include/ChangeLog:

2016-11-22  Jose E. Marchesi  <jose.marchesi@oracle.com>

       	* opcode/sparc.h (sparc_opcode_arch): New fields hwcaps and
       	hwcaps2.

opcodes/ChangeLog:

2016-11-22  Jose E. Marchesi  <jose.marchesi@oracle.com>

       	* sparc-opc.c (HWS_V8): Definition moved from
       	gas/config/tc-sparc.c.
       	(HWS_V9): Likewise.
       	(HWS_VA): Likewise.
       	(HWS_VB): Likewise.
       	(HWS_VC): Likewise.
       	(HWS_VD): Likewise.
       	(HWS_VE): Likewise.
       	(HWS_VV): Likewise.
       	(HWS_VM): Likewise.
       	(HWS2_VM): Likewise.
       	(sparc_opcode_archs): Initialize hwcaps and hwcaps2 fields of
       	existing entries.
2016-11-22 04:40:37 -08:00
..
aarch64.h [AArch64] Add ARMv8.3 FCMLA and FCADD instructions 2016-11-18 10:02:16 +00:00
alpha.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
arc-func.h Fixes to legacy ARC relocations. 2016-08-26 12:09:17 +02:00
arc.h arc: Implement NPS-400 dcmac instruction 2016-11-03 17:14:38 +00:00
arm.h Add support for ARM Cortex-M33 processor 2016-11-04 16:24:59 +00:00
avr.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
bfin.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
cgen.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
convex.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
cr16.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
cris.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
crx.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
d10v.h add more extern C 2016-06-01 21:26:32 -04:00
d30v.h add more extern C 2016-06-01 21:26:32 -04:00
dlx.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
ft32.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
h8300.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
hppa.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
i370.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
i386.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
i860.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
i960.h make more variables const 2016-03-22 19:16:06 -04:00
ia64.h add more extern C 2016-06-01 21:26:32 -04:00
m68hc11.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
m68k.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
m88k.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
metag.h metag: add extern C to header 2016-05-26 06:12:15 -04:00
mips.h add more extern C 2016-06-01 21:26:32 -04:00
mmix.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
mn10200.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
mn10300.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
moxie.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
msp430-decode.h Change the size field of MSP430_Opcode_Decoded to a plain integer. 2016-06-14 11:41:34 -07:00
msp430.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
nds32.h Fix compile time warnings building the binutils with a gcc6 compiler. 2016-02-09 16:34:24 +00:00
nios2.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
nios2r1.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
nios2r2.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
np1.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
ns32k.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
pdp11.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
pj.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
pn.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
ppc.h PR20744, Incorrect PowerPC VLE relocs 2016-11-22 20:19:29 +10:30
pyr.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
riscv-opc.h Add support for RISC-V architecture. 2016-11-01 16:45:57 +00:00
riscv.h Add support for RISC-V architecture. 2016-11-01 16:45:57 +00:00
rl78.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
rx.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
s390.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
score-datadep.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
score-inst.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
sparc.h gas,opcodes: fix hardware capabilities bumping in the sparc assembler. 2016-11-22 04:40:37 -08:00
spu-insns.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
spu.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
tahoe.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
tic4x.h make more variables const 2016-03-22 19:16:06 -04:00
tic6x-control-registers.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
tic6x-insn-formats.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
tic6x-opcode-table.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
tic6x.h add more extern C 2016-06-01 21:26:32 -04:00
tic30.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
tic54x.h tic54x: rename typedef of struct symbol_ 2016-05-23 01:17:12 -04:00
tic80.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
tilegx.h tilegx: move TILEGX_NUM_PIPELINE_ENCODINGS to tilegx_pipeline enum 2016-06-22 05:14:08 -04:00
tilepro.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
v850.h add more extern C 2016-06-01 21:26:32 -04:00
vax.h Copyright update for binutils 2016-01-01 23:00:01 +10:30
visium.h Add const qualifiers at various places. 2016-03-07 15:16:28 +00:00
xgate.h Copyright update for binutils 2016-01-01 23:00:01 +10:30