aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2016-07-01 09:06:16 +0200
committerJan Beulich <jbeulich@suse.com>2016-07-01 09:06:16 +0200
commit327e8c421bbe0f7e411bb772ee7d6353f2571a8d (patch)
tree3bf5cf5828810d58a8f89cf74756e324f57884f4 /gas/config
parent83b16ac69492ab493bfc87f147bf84c167bc6f30 (diff)
downloadgdb-327e8c421bbe0f7e411bb772ee7d6353f2571a8d.zip
gdb-327e8c421bbe0f7e411bb772ee7d6353f2571a8d.tar.gz
gdb-327e8c421bbe0f7e411bb772ee7d6353f2571a8d.tar.bz2
x86/MPX: fix address size handling
While address overrides are ignored in 64-bit mode (and hence shouldn't really result in an error, but upon v1 converting this to a warning I was told otherwise), trying to use 16-bit addressing is documented to result in #UD, and hence the assembler should reject the attempt. (The added test case at once also checks that bndc{l,n,u} won't accept 16-bit register operands.)
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 9f1b7f0..db90496 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3666,10 +3666,15 @@ md_assemble (char *line)
if (i.bnd_prefix && !i.tm.opcode_modifier.bndprefixok)
as_bad (_("expecting valid branch instruction after `bnd'"));
- if (i.tm.cpu_flags.bitfield.cpumpx
- && flag_code == CODE_64BIT
- && i.prefix[ADDR_PREFIX])
- as_bad (_("32-bit address isn't allowed in 64-bit MPX instructions."));
+ if (i.tm.cpu_flags.bitfield.cpumpx)
+ {
+ if (flag_code == CODE_64BIT && i.prefix[ADDR_PREFIX])
+ as_bad (_("32-bit address isn't allowed in 64-bit MPX instructions."));
+ else if (flag_code != CODE_16BIT
+ ? i.prefix[ADDR_PREFIX]
+ : i.mem_operands && !i.prefix[ADDR_PREFIX])
+ as_bad (_("16-bit address isn't allowed in MPX instructions"));
+ }
/* Insert BND prefix. */
if (add_bnd_prefix