aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-09-30 16:33:35 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-09-30 16:33:52 -0700
commit27f134698ac529f3050f5ddbd31a0ab0bbe5be99 (patch)
tree4d78aee19d40896740744c7d668272fd0b186e66 /gas/config
parent95eb9e54a51fdb819c8525a0a33138d861f31bc8 (diff)
downloadgdb-27f134698ac529f3050f5ddbd31a0ab0bbe5be99.zip
gdb-27f134698ac529f3050f5ddbd31a0ab0bbe5be99.tar.gz
gdb-27f134698ac529f3050f5ddbd31a0ab0bbe5be99.tar.bz2
x86: Check register operand for AddrPrefixOpReg
If the address prefix changes the register operand, we need to check the register operand when the memory operand is RIP-relative. PR gas/26685 * config/tc-i386.c (process_suffix): Check the register operand for the address size prefix if the memory operand is symbol(%rip). * testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative addressing. * testsuite/gas/i386/x86-64-movdir.s: Likewise. * testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated. * testsuite/gas/i386/x86-64-enqcmd.d: Likewise. * testsuite/gas/i386/x86-64-movdir-intel.d: Likewise. * testsuite/gas/i386/x86-64-movdir.d: Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 4891c45a..094f555 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7178,6 +7178,19 @@ process_suffix (void)
unsigned int op;
enum { need_word, need_dword, need_qword } need;
+ /* Check the register operand for the address size prefix if
+ the memory operand is symbol(%rip). */
+ if (i.mem_operands == 1
+ && i.reg_operands == 1
+ && i.operands == 2
+ && i.base_reg
+ && i.base_reg->reg_num == RegIP
+ && i.base_reg->reg_type.bitfield.qword
+ && i.types[1].bitfield.class == Reg
+ && i.op[1].regs->reg_type.bitfield.dword
+ && !add_prefix (ADDR_PREFIX_OPCODE))
+ return 0;
+
if (flag_code == CODE_32BIT)
need = i.prefix[ADDR_PREFIX] ? need_word : need_dword;
else if (i.prefix[ADDR_PREFIX])