[PATCH 1/5] x86: avoid attaching suffixes to unambiguous insns
H.J. Lu
hjl.tools@gmail.com
Tue Jul 14 13:06:45 GMT 2020
On Tue, Jul 14, 2020 at 12:12:21PM +0200, Jan Beulich wrote:
> "Unambiguous" is is in particular taking as reference the assembler,
> which also accepts certain insns - despite them allowing for varying
> operand size, and hence in principle being ambiguous - without any
> suffix. For example, from the very beginning of the life of x86-64 I had
> trouble understanding why a plain and simple RET had to be printed as
> RETQ. In case someone really used the 16-bit form, RETW disambiguates
> the two quite fine.
>
> gas/
> 2020-07-XX Jan Beulich <jbeulich@suse.com>
>
> * testsuite/gas/i386/disassem.d,
> testsuite/gas/i386/ilp32/x86-64-branch.d,
> testsuite/gas/i386/intel.d, testsuite/gas/i386/jump16.d,
> testsuite/gas/i386/lfence-load.d, testsuite/gas/i386/noreg16.d,
> testsuite/gas/i386/noreg32.d,
> testsuite/gas/i386/noreg64-rex64.d,
> testsuite/gas/i386/noreg64.d, testsuite/gas/i386/notrack.d,
> testsuite/gas/i386/opcode.d,
> testsuite/gas/i386/solaris/x86-64-branch-2.d,
> testsuite/gas/i386/solaris/x86-64-jump.d,
> testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d,
> testsuite/gas/i386/solaris/x86-64-nop-3.d,
> testsuite/gas/i386/solaris/x86-64-nop-4.d,
> testsuite/gas/i386/solaris/x86-64-nop-5.d,
> testsuite/gas/i386/solaris/x86-64-relax-2.d,
> testsuite/gas/i386/solaris/x86-64-relax-3.d,
> testsuite/gas/i386/x86-64-align-branch-1a.d,
> testsuite/gas/i386/x86-64-align-branch-1b.d,
> testsuite/gas/i386/x86-64-align-branch-1c.d,
> testsuite/gas/i386/x86-64-align-branch-1d.d,
> testsuite/gas/i386/x86-64-align-branch-1e.d,
> testsuite/gas/i386/x86-64-align-branch-1f.d,
> testsuite/gas/i386/x86-64-align-branch-1g.d,
> testsuite/gas/i386/x86-64-align-branch-1h.d,
> testsuite/gas/i386/x86-64-align-branch-1i.d,
> testsuite/gas/i386/x86-64-align-branch-2a.d,
> testsuite/gas/i386/x86-64-align-branch-2b.d,
> testsuite/gas/i386/x86-64-align-branch-2c.d,
> testsuite/gas/i386/x86-64-align-branch-3.d,
> testsuite/gas/i386/x86-64-align-branch-4a.d,
> testsuite/gas/i386/x86-64-align-branch-4b.d,
> testsuite/gas/i386/x86-64-align-branch-5.d,
> testsuite/gas/i386/x86-64-align-branch-6.d,
> testsuite/gas/i386/x86-64-branch-2.d,
> testsuite/gas/i386/x86-64-branch-3.d,
> testsuite/gas/i386/x86-64-branch.d,
> testsuite/gas/i386/x86-64-disassem.d,
> testsuite/gas/i386/x86-64-disp32.d,
> testsuite/gas/i386/x86-64-gotpcrel-no-relax.d,
> testsuite/gas/i386/x86-64-gotpcrel.d,
> testsuite/gas/i386/x86-64-ifunc.d,
> testsuite/gas/i386/x86-64-jump.d,
> testsuite/gas/i386/x86-64-lfence-byte.d,
> testsuite/gas/i386/x86-64-lfence-indbr-a.d,
> testsuite/gas/i386/x86-64-lfence-indbr-b.d,
> testsuite/gas/i386/x86-64-lfence-indbr-c.d,
> testsuite/gas/i386/x86-64-lfence-load.d,
> testsuite/gas/i386/x86-64-lfence-ret-a.d,
> testsuite/gas/i386/x86-64-lfence-ret-b.d,
> testsuite/gas/i386/x86-64-lfence-ret-c.d,
> testsuite/gas/i386/x86-64-lfence-ret-d.d,
> testsuite/gas/i386/x86-64-lfence-ret-e.d,
> testsuite/gas/i386/x86-64-mpx-add-bnd-prefix.d,
> testsuite/gas/i386/x86-64-mpx-branch-1.d,
> testsuite/gas/i386/x86-64-mpx.d,
> testsuite/gas/i386/x86-64-nop-3.d,
> testsuite/gas/i386/x86-64-nop-4.d,
> testsuite/gas/i386/x86-64-nop-5.d,
> testsuite/gas/i386/x86-64-nops-7.d,
> testsuite/gas/i386/x86-64-notrack.d,
> testsuite/gas/i386/x86-64-opcode.d,
> testsuite/gas/i386/x86-64-relax-2.d,
> testsuite/gas/i386/x86-64-relax-3.d,
> testsuite/gas/i386/x86-64-relax-4.d,
> testsuite/gas/i386/x86-64-rtm.d,
> testsuite/gas/i386/x86-64-stack.d,
> testsuite/gas/i386/x86-64-unique.d,
> testsuite/gas/i386/x86_64-intel.d: Adjust expectations.
>
> ld/
> 2020-07-XX Jan Beulich <jbeulich@suse.com>
>
> * testsuite/ld-i386/ibt-plt-1.d, testsuite/ld-i386/ibt-plt-2a.d,
> testsuite/ld-i386/ibt-plt-2c.d, testsuite/ld-i386/ibt-plt-3a.d,
> testsuite/ld-i386/ibt-plt-3c.d, testsuite/ld-i386/plt-pic.pd,
> testsuite/ld-i386/plt-pic2.dd, testsuite/ld-i386/plt.pd,
> testsuite/ld-i386/plt2.dd, testsuite/ld-i386/pr19636-1d.d,
> testsuite/ld-i386/pr19636-1l.d, testsuite/ld-i386/pr19636-2c.d,
> testsuite/ld-i386/pr20830.d, testsuite/ld-i386/vxworks1-lib.dd,
> testsuite/ld-i386/vxworks1.dd,
> testsuite/ld-ifunc/ifunc-2-i386-now.d,
> testsuite/ld-ifunc/ifunc-2-local-i386-now.d,
> testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d,
> testsuite/ld-ifunc/ifunc-2-x86-64-now.d,
> testsuite/ld-ifunc/ifunc-21-x86-64.d,
> testsuite/ld-ifunc/ifunc-22-x86-64.d,
> testsuite/ld-ifunc/pr17154-i386-now.d,
> testsuite/ld-ifunc/pr17154-i386.d,
> testsuite/ld-ifunc/pr17154-x86-64-now.d,
> testsuite/ld-ifunc/pr17154-x86-64.d,
> testsuite/ld-x86-64/align-branch-1.d,
> testsuite/ld-x86-64/bnd-branch-1-now.d,
> testsuite/ld-x86-64/bnd-branch-1.d,
> testsuite/ld-x86-64/bnd-ifunc-1-now.d,
> testsuite/ld-x86-64/bnd-ifunc-1.d,
> testsuite/ld-x86-64/bnd-ifunc-2-now.d,
> testsuite/ld-x86-64/bnd-ifunc-2.d,
> testsuite/ld-x86-64/bnd-plt-1-now.d,
> testsuite/ld-x86-64/bnd-plt-1.d,
> testsuite/ld-x86-64/call1a.d, testsuite/ld-x86-64/call1b.d,
> testsuite/ld-x86-64/call1d.d, testsuite/ld-x86-64/call1e.d,
> testsuite/ld-x86-64/call1f.d, testsuite/ld-x86-64/call1g.d,
> testsuite/ld-x86-64/call1h.d, testsuite/ld-x86-64/call1i.d,
> testsuite/ld-x86-64/gotpcrel1.dd,
> testsuite/ld-x86-64/hidden2.d,
> testsuite/ld-x86-64/ibt-plt-1-x32.d,
> testsuite/ld-x86-64/ibt-plt-1.d,
> testsuite/ld-x86-64/ibt-plt-2a-x32.d,
> testsuite/ld-x86-64/ibt-plt-2a.d,
> testsuite/ld-x86-64/ibt-plt-2c-x32.d,
> testsuite/ld-x86-64/ibt-plt-2c.d,
> testsuite/ld-x86-64/ibt-plt-3a-x32.d,
> testsuite/ld-x86-64/ibt-plt-3a.d,
> testsuite/ld-x86-64/ibt-plt-3c-x32.d,
> testsuite/ld-x86-64/ibt-plt-3c.d,
> testsuite/ld-x86-64/libno-plt-1b.dd,
> testsuite/ld-x86-64/mpx3.dd, testsuite/ld-x86-64/mpx3n.dd,
> testsuite/ld-x86-64/mpx4.dd, testsuite/ld-x86-64/mpx4n.dd,
> testsuite/ld-x86-64/no-plt-1a.dd,
> testsuite/ld-x86-64/no-plt-1b.dd,
> testsuite/ld-x86-64/no-plt-1c.dd,
> testsuite/ld-x86-64/no-plt-1d.dd,
> testsuite/ld-x86-64/no-plt-1e.dd,
> testsuite/ld-x86-64/no-plt-1f.dd,
> testsuite/ld-x86-64/no-plt-1g.dd,
> testsuite/ld-x86-64/plt-main-bnd.dd,
> testsuite/ld-x86-64/plt-main-ibt-x32.dd,
> testsuite/ld-x86-64/plt-main-ibt.dd,
> testsuite/ld-x86-64/plt.pd, testsuite/ld-x86-64/plt2.dd,
> testsuite/ld-x86-64/pr19609-5a.d,
> testsuite/ld-x86-64/pr19609-5b.d,
> testsuite/ld-x86-64/pr19609-5c.d,
> testsuite/ld-x86-64/pr19609-5e.d,
> testsuite/ld-x86-64/pr19609-7b.d,
> testsuite/ld-x86-64/pr19609-7d.d,
> testsuite/ld-x86-64/pr19636-2d.d,
> testsuite/ld-x86-64/pr19636-2l.d,
> testsuite/ld-x86-64/pr20253-1b.d,
> testsuite/ld-x86-64/pr20253-1d.d,
> testsuite/ld-x86-64/pr20253-1f.d,
> testsuite/ld-x86-64/pr20253-1h.d,
> testsuite/ld-x86-64/pr20253-1j.d,
> testsuite/ld-x86-64/pr20253-1l.d,
> testsuite/ld-x86-64/pr20830a-now.d,
> testsuite/ld-x86-64/pr20830a.d,
> testsuite/ld-x86-64/pr20830b-now.d,
> testsuite/ld-x86-64/pr20830b.d,
> testsuite/ld-x86-64/pr21038a-now.d,
> testsuite/ld-x86-64/pr21038a.d,
> testsuite/ld-x86-64/pr21038b-now.d,
> testsuite/ld-x86-64/pr21038b.d,
> testsuite/ld-x86-64/pr21038c-now.d,
> testsuite/ld-x86-64/pr21038c.d,
> testsuite/ld-x86-64/pr23930-x32.d,
> testsuite/ld-x86-64/pr23930.d,
> testsuite/ld-x86-64/pr25416-1a.d,
> testsuite/ld-x86-64/pr25416-2a.d,
> testsuite/ld-x86-64/pr26018.d,
> testsuite/ld-x86-64/protected2-k1om.d,
> testsuite/ld-x86-64/protected2-l1om.d,
> testsuite/ld-x86-64/protected2.d,
> testsuite/ld-x86-64/protected3.d,
> testsuite/ld-x86-64/protected8.d,
> testsuite/ld-x86-64/tlsbin.dd, testsuite/ld-x86-64/tlsbin2.dd,
> testsuite/ld-x86-64/tlsbindesc.dd,
> testsuite/ld-x86-64/tlsdesc.dd,
> testsuite/ld-x86-64/tlsdesc.pd,
> testsuite/ld-x86-64/tlsgd10.dd,
> testsuite/ld-x86-64/tlsgd7.dd, testsuite/ld-x86-64/tlsgd8.dd,
> testsuite/ld-x86-64/tlsgd9.dd,
> testsuite/ld-x86-64/tlsgdesc.dd,
> testsuite/ld-x86-64/tlsld3.dd, testsuite/ld-x86-64/tlsld4.dd,
> testsuite/ld-x86-64/tlspic.dd, testsuite/ld-x86-64/tlspic2.dd,
> testsuite/ld-x86-64/tlspie2b.d, testsuite/ld-x86-64/tlspie2c.d:
> Adjust expectations.
>
> opcodes/
> 2020-07-XX Jan Beulich <jbeulich@suse.com>
>
> * i386-dis.c (dis386): Adjust 'P', 'T', 'U', and '@'
> description. Drop '&' description. Use P for push of immediate,
> pushf/popf, enter, and leave. Use %LP for lret/retf.
> (dis386_twobyte): Use P for push/pop of fs/gs.
> (reg_table): Use P for push/pop. Use @ for near call/jmp.
> (x86_64_table): Use P for far call/jmp.
> (putop): Drop handling of 'U' and '&'. Move and adjust handling
> of '@'. Adjust handling of 'P' and 'T'. Drop case_P and case_Q
> labels.
> (OP_J): Drop marking of REX_W as used for v_mode (ISA-dependent)
> and dqw_mode (unconditional).
OK.
>
> ---
> I wonder whether retaining 'T' for just XBEGIN makes sense. '@' handling
> could as well special case that one opcode (to emit 'w' even in Intel64
> mode when there's an operand size prefix). Furthermore gas doesn't
> accept any suffixes on it, so the question if whether assembler and
> disassembler shouldn't be brought in line (in whichever direction).
>
We can drop 'T' and handle it the same way as Jcc.
Thanks.
H.J.
More information about the Binutils
mailing list