diff options
author | 2023-09-08 08:45:11 +0200 | |
---|---|---|
committer | 2023-09-18 01:51:24 +0200 | |
commit | e3ed970fc5855687aeaad2482db39d52deb8aa33 (patch) | |
tree | 5c30c9166bf77964cc91b33cd13f45cc87abd6ba | |
parent | PR30794, PowerPC gold: internal error in add_output_section_to_load (diff) | |
download | binutils-gdb-e3ed970fc5855687aeaad2482db39d52deb8aa33.tar.gz binutils-gdb-e3ed970fc5855687aeaad2482db39d52deb8aa33.tar.bz2 binutils-gdb-e3ed970fc5855687aeaad2482db39d52deb8aa33.zip |
x86: restrict prefix use with .insn VEX/XOP/EVEX
Avoid triggering the respective abort() in output_insn().
(cherry picked from commit b6f6a3ecd15f4c55a4652933f8478feb8b685788)
-rw-r--r-- | gas/config/tc-i386.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index de35ee2a2c6..4d85f8bcf14 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -10671,6 +10671,29 @@ s_insn (int dummy ATTRIBUTE_UNUSED) if (line > end && i.vec_encoding == vex_encoding_default) i.vec_encoding = evex ? vex_encoding_evex : vex_encoding_vex; + if (i.vec_encoding != vex_encoding_default) + { + /* Only address size and segment override prefixes are permitted with + VEX/XOP/EVEX encodings. */ + const unsigned char *p = i.prefix; + + for (j = 0; j < ARRAY_SIZE (i.prefix); ++j, ++p) + { + if (!*p) + continue; + + switch (j) + { + case SEG_PREFIX: + case ADDR_PREFIX: + break; + default: + as_bad (_("illegal prefix used with VEX/XOP/EVEX")); + goto bad; + } + } + } + if (line > end && *line == '.') { /* Length specifier (VEX.L, XOP.L, EVEX.L'L). */ |