aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-05-02 10:46:55 -0700
committerH.J. Lu <hjl.tools@gmail.com>2019-05-02 10:47:04 -0700
commit06f74c5cb868cfd37af3e680d29784c217700bdf (patch)
treecb19afcc9839414386df4b0e684604ea6d2a17ae /gas/config
parentb8c05e85ef4ce9610a3a43198180cf24aea327cb (diff)
downloadgdb-06f74c5cb868cfd37af3e680d29784c217700bdf.zip
gdb-06f74c5cb868cfd37af3e680d29784c217700bdf.tar.gz
gdb-06f74c5cb868cfd37af3e680d29784c217700bdf.tar.bz2
i386: Issue a warning to IRET without suffix for .code16gcc
The .code16gcc directive to support 16-bit mode with 32-bit address. For IRET without a suffix, generate 16-bit IRET with a warning to return from an interrupt handler in 16-bit mode. PR gas/24485 * config/tc-i386.c (process_suffix): Issue a warning to IRET without a suffix for .code16gcc. * testsuite/gas/i386/jump16.s: Add tests for iretX. * testsuite/gas/i386/jump16.d: Updated. * testsuite/gas/i386/jump16.e: New file.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 032b1d3..7159432 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -6242,7 +6242,19 @@ process_suffix (void)
/* exclude fldenv/frstor/fsave/fstenv */
&& i.tm.opcode_modifier.no_ssuf)
{
- i.suffix = stackop_size;
+ if (stackop_size == LONG_MNEM_SUFFIX
+ && i.tm.base_opcode == 0xcf)
+ {
+ /* stackop_size is set to LONG_MNEM_SUFFIX for the
+ .code16gcc directive to support 16-bit mode with
+ 32-bit address. For IRET without a suffix, generate
+ 16-bit IRET (opcode 0xcf) to return from an interrupt
+ handler. */
+ i.suffix = WORD_MNEM_SUFFIX;
+ as_warn (_("generating 16-bit `iret' for .code16gcc directive"));
+ }
+ else
+ i.suffix = stackop_size;
}
else if (intel_syntax
&& !i.suffix
@@ -6352,13 +6364,7 @@ process_suffix (void)
if (!add_prefix (ADDR_PREFIX_OPCODE))
return 0;
}
- /* stackop_size is set to LONG_MNEM_SUFFIX for the .code16gcc
- directive to support 16bit mode with 32-bit address. Since
- IRET (opcode 0xcf) in 16bit mode returns from an interrupt
- in 16bit mode, we shouldn't add DATA_PREFIX_OPCODE here. */
else if (i.suffix != QWORD_MNEM_SUFFIX
- && (stackop_size != LONG_MNEM_SUFFIX
- || i.tm.base_opcode != 0xcf)
&& !i.tm.opcode_modifier.ignoresize
&& !i.tm.opcode_modifier.floatmf
&& !i.tm.opcode_modifier.vex