[PATCH v2] x86: Disallow GOT memory as vector memory operand

Jan Beulich jbeulich@suse.com
Thu Feb 6 13:02:16 GMT 2025
On 06.02.2025 04:32, H.J. Lu wrote:
> GOT memory is 4-byte for i386 and 8-byte for x86-64.  Disallow GOT memory
> as vector memory operand for vector instructions which don't support 32-bit
> nor 64-bit memory.
> 
> PR gas/32624
> * config/tc-i386.c (output_disp): Disallow GOT memory as vector
> memory operand.
> * testsuite/gas/i386/got.s: Add vcvtph2qq with GOT memory.
> * testsuite/gas/i386/x86-64-gotpcrel-2.s: Add vcvtph2qq and
> vcvtps2pd with GOT memory.
> * testsuite/gas/i386/got-no-relax.d: Updated.
> * testsuite/gas/i386/got.d: Likewise.
> * testsuite/gas/i386/x86-64-gotpcrel-2.d: Likewise.
> * testsuite/gas/i386/i386.exp: Run inval-got.
> * testsuite/gas/i386/inval-got.l: New file.
> * testsuite/gas/i386/inval-got.s: Likewise.
> * testsuite/gas/i386/x86-64-inval-got.l: Likewise.
> * testsuite/gas/i386/x86-64-inval-got.l: Likewise.
> * testsuite/gas/i386/x86-64.exp: Run x86-64-inval-got.

Hmm, I'm further puzzled: On what basis would VCVTPS2DQ and VCVTPH2QQ be
okay to use with an operand in GOT?

And then, if I'm reading the added logic right,

	VADDPS foo@GOTPCREL(%rip), %zmm0, %zmm1

would be permitted despite having a 512-bit memory operand, just because
it also permits embedded broadcast (which isn't in use here). Whereas

	VADDPS foo@GOTPCREL(%rip), %ymm0, %ymm1

wouldn't be, unless prefixed by {evex}. How in the world are people to
infer what is or is not allowed by the assembler?

As before, my requirements are:
1) underlying criteria being clearly / unambiguously spelled out in the
   psABI, and/or
2) such extra checking being optional, default-off (to some degree
depending on how things would be worded in the psABI).

Jan


More information about the Binutils mailing list