aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-i386.c
diff options
context:
space:
mode:
authorliuhongt <hongtao.liu@intel.com>2020-05-09 15:02:50 +0800
committerliuhongt <hongtao.liu@intel.com>2020-05-18 10:23:59 +0800
commit503648e41efa19dfb059757ffddf0206b6060520 (patch)
tree29a806712618bc2fedf880b6db9270e33557f966 /gas/config/tc-i386.c
parent07a78c595604b00908f06396aa221d446adbe6f8 (diff)
downloadgdb-503648e41efa19dfb059757ffddf0206b6060520.zip
gdb-503648e41efa19dfb059757ffddf0206b6060520.tar.gz
gdb-503648e41efa19dfb059757ffddf0206b6060520.tar.bz2
Don't handle lret/iret when -mlfence-before-ret=[or|not|shl|yes] since they are invalid in SGX enclaves.
gas/ChangeLog * gas/config/tc-i386.c: Not handle lret/iret. * gas/testsuite/gas/i386/lfence-ret-a.d: Adjust testcase. * gas/testsuite/gas/i386/lfence-ret-b.d: Ditto. * gas/testsuite/gas/i386/lfence-ret-c.d: Ditto. * gas/testsuite/gas/i386/lfence-ret-d.d: Ditto. * gas/testsuite/gas/i386/lfence-ret.s: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-a.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-b.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-c.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-d.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-e.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret.s: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret.e: Deleted.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r--gas/config/tc-i386.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 32fd6c1..ae1bd0d 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4591,13 +4591,10 @@ insert_lfence_before (void)
return;
}
- /* Output or/not/shl and lfence before ret/lret/iret. */
+ /* Output or/not/shl and lfence before near ret. */
if (lfence_before_ret != lfence_before_ret_none
&& (i.tm.base_opcode == 0xc2
- || i.tm.base_opcode == 0xc3
- || i.tm.base_opcode == 0xca
- || i.tm.base_opcode == 0xcb
- || i.tm.base_opcode == 0xcf))
+ || i.tm.base_opcode == 0xc3))
{
if (last_insn.kind != last_insn_other
&& last_insn.seg == now_seg)
@@ -4608,17 +4605,10 @@ insert_lfence_before (void)
return;
}
- /* lret or iret. */
- bfd_boolean lret = (i.tm.base_opcode | 0x5) == 0xcf;
- bfd_boolean has_rexw = i.prefix[REX_PREFIX] & REX_W;
- char prefix = 0x0;
- /* Default operand size for far return is 32 bits,
- 64 bits for near return. */
/* Near ret ingore operand size override under CPU64. */
- if ((!lret && flag_code == CODE_64BIT) || has_rexw)
- prefix = 0x48;
- else if (i.prefix[DATA_PREFIX])
- prefix = 0x66;
+ char prefix = flag_code == CODE_64BIT
+ ? 0x48
+ : i.prefix[DATA_PREFIX] ? 0x66 : 0x0;
if (lfence_before_ret == lfence_before_ret_not)
{