This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 4/4] x86/Intel: fix "near ptr" / "far ptr" handling
- From: Jan Beulich <jbeulich at suse dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Thu, 5 Dec 2019 08:40:31 +0100
- Subject: [PATCH 4/4] x86/Intel: fix "near ptr" / "far ptr" handling
- References: <95e30688-f281-41ea-e9e2-c82692241972@suse.com>
Commit dc2be329b950 ("i386: Only check suffix in instruction mnemonic")
broke rejecting of these for floating point insns. Fix this by setting
the "byte" operand attribute, which will now (again) cause an error.
Furthermore the diagnostic for the "far ptr" case in general and for the
"near ptr" case in the non-float cases became "invalid instruction
suffix" instead of the intended "operand size mismatch". Fix this by
also setting the "tbyte" operand attribute (no insn template accepts
both byte and tbyte operands).
gas/
2019-12-XX Jan Beulich <jbeulich@suse.com>
* config/tc-i386-intel.c (i386_intel_operand): Set "byte"
attribute suffix instead of suffix for floating point insns when
handling O_near_ptr / O_far_ptr.
--- a/gas/config/tc-i386-intel.c
+++ b/gas/config/tc-i386-intel.c
@@ -718,9 +718,12 @@ i386_intel_operand (char *operand_string
case O_near_ptr:
if (current_templates->start->opcode_modifier.jump != JUMP
&& current_templates->start->opcode_modifier.jump != JUMP_DWORD)
- suffix = got_a_float /* so it will cause an error */
- ? BYTE_MNEM_SUFFIX
- : LONG_DOUBLE_MNEM_SUFFIX;
+ {
+ /* cause an error */
+ i.types[this_operand].bitfield.byte = 1;
+ i.types[this_operand].bitfield.tbyte = 1;
+ suffix = i.suffix;
+ }
break;
default:
--- a/gas/testsuite/gas/i386/intelbad.l
+++ b/gas/testsuite/gas/i386/intelbad.l
@@ -157,3 +157,7 @@
.*:176: Warning: .*
.*:177: Error: .*
.*:178: Error: .*
+.*:180: Error: .*
+.*:181: Error: .*
+.*:183: Error: .*
+.*:184: Error: .*
--- a/gas/testsuite/gas/i386/intelbad.s
+++ b/gas/testsuite/gas/i386/intelbad.s
@@ -176,3 +176,9 @@ start:
lfs eax, dword ptr [eax]
lgs eax, qword ptr [eax]
lss eax, tbyte ptr [eax]
+
+ fld near ptr [ebx]
+ fst far ptr [ebx]
+
+ fild far ptr [ebx]
+ fist near ptr [ebx]