Bug 20705 - [libopcodes][x86] VEX masking register name lacks formatting, cannot assemble
Summary: [libopcodes][x86] VEX masking register name lacks formatting, cannot assemble
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: 2.28
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-17 17:52 UTC by nholcomb
Modified: 2016-10-20 22:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nholcomb 2016-10-17 17:52:09 UTC
The following instruction produced by objdump cannot be assembled with gas due to an error.

Bytes: c5 ac 46 f5
Instruction: kxnorw %k5, k2, %k6
ERROR: operand size mismatch for `kxnorw'

By changing the second operand to "%k2" instead of "k2", the output could be reassembled. I'm not sure if this should be reported to gas as well to allow the "k2" syntax in addition to "%k2", but I think objdump should be producing valid assembly regardless.
Comment 1 Sourceware Commits 2016-10-20 22:28:00 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9889cbb14ebea4b281408afcfd94ad6646ab370a

commit 9889cbb14ebea4b281408afcfd94ad6646ab370a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Oct 20 15:07:42 2016 -0700

    Check invalid mask registers
    
    In 32-bit, the REX_B bit in the 3-byte VEX prefix is ignored and the
    the highest bit in VEX.vvvv is either 1 or ignored.  In 64-bit, we
    need to check invalid mask registers.
    
    gas/
    
    	PR binutis/20705
    	* testsuite/gas/i386/i386.exp: Run x86-64-opcode-bad.
    	* testsuite/gas/i386/x86-64-opcode-bad.d: New file.
    	* testsuite/gas/i386/x86-64-opcode-bad.s: Likewise.
    
    opcodes/
    
    	PR binutis/20705
    	* i386-dis.c (get_valid_dis386): Ignore the REX_B bit and
    	the highest bit in VEX.vvvv for the 3-byte VEX prefix in
    	32-bit mode.  Don't check vex.register_specifier in 32-bit
    	mode.
    	(OP_E_register): Check invalid mask registers.
    	(OP_G): Likewise.
    	(OP_VEX): Likewise.
Comment 2 H.J. Lu 2016-10-20 22:28:49 UTC
Fixed.