]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: Warn .insn instruction with length > 15 bytes
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 5 Feb 2024 19:58:08 +0000 (11:58 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 6 Feb 2024 11:32:17 +0000 (03:32 -0800)
Change .insn instruction with length > 15 bytes from error to warning.

PR gas/31323
* config/tc-i386.c (output_insn): Issue a warning when .insn
instruction length exceeds the limit of 15 bytes.
* testsuite/gas/i386/oversized64.s: Add a test for .insn
* testsuite/gas/i386/oversized64.l: Updated.

gas/config/tc-i386.c
gas/testsuite/gas/i386/oversized64.l
gas/testsuite/gas/i386/oversized64.s

index 8f3a1b6f6864840b4e08992ffc70901fa3d1d9ad..047aaba567e88128252c892876e7c284ac6ba5b2 100644 (file)
@@ -11780,8 +11780,14 @@ output_insn (const struct last_insn *last_insn)
        {
          j = encoding_length (insn_start_frag, insn_start_off, frag_more (0));
          if (j > 15)
-           as_bad (_("instruction length of %u bytes exceeds the limit of 15"),
-                   j);
+           {
+             if (dot_insn ())
+               as_warn (_("instruction length of %u bytes exceeds the limit of 15"),
+                       j);
+             else
+               as_bad (_("instruction length of %u bytes exceeds the limit of 15"),
+                       j);
+           }
          else if (fragP)
            {
              /* NB: Don't add prefix with GOTPC relocation since
index ac32c4d813951a7ea9620fcc9a305ef9e153f940..f709456c5e53d992ac44f5a4698718ca9546b382 100644 (file)
@@ -4,6 +4,7 @@
 .*:7: Error: instruction length.*
 .*:9: Error: instruction length.*
 .*:10: Error: instruction length.*
+.*:13: Warning: instruction length.*
 GAS LISTING .*
 
 
@@ -37,4 +38,11 @@ GAS LISTING .*
 [      ]*10[   ]+48812CC5[     ]*
 [      ]*10[   ]+00000000[     ]*
 [      ]*10[   ]+44332211[     ]*
+[      ]*11[   ]+
+[      ]*12[   ]+\.att_syntax prefix
+[      ]*13[   ]+\?\?\?\? 6762F1FC[    ]+.insn EVEX.L0.0f 12/0, \$0x11223344,\(,%eax,8\),%rax
+\*\*\*\*  Warning: instruction length of 16 bytes exceeds the limit of 15
+[      ]*13[   ]+080C04C5[     ]*
+[      ]*13[   ]+00000000[     ]*
+[      ]*13[   ]+44332211[     ]*
 #pass
index 9db09af3f152d02ed6341320660f39504e8da79f..77a08a9c5332a338ec2aea0575f90ab26fc1aaa5 100644 (file)
@@ -8,3 +8,6 @@ long64:
 
        xacquire lock add qword ptr gs:[eax*8], 0x11223344
        xrelease lock sub qword ptr gs:[eax*8], 0x11223344
+
+       .att_syntax prefix
+       .insn EVEX.L0.0f 12/0, $0x11223344,(,%eax,8),%rax