]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: no md_cons_align() for .nop{,s}
authorJan Beulich <jbeulich@suse.com>
Fri, 1 Dec 2023 07:28:20 +0000 (08:28 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 1 Dec 2023 07:28:20 +0000 (08:28 +0100)
.nop and .nops generate code, not data. Hence them invoking
md_cons_align() is at best inappropriate. In fact it actually gets in
the of x86'es state maintenance involving i386_cons_align().

gas/read.c
gas/testsuite/gas/i386/align-branch-6.e
gas/testsuite/gas/i386/lfence-byte.d
gas/testsuite/gas/i386/lfence-byte.s

index 826156db3fe24d534201c979e5250bbcdac7c8b2..76ef86c523c4751a86905d6ca05234ebab3e8715 100644 (file)
@@ -3466,10 +3466,6 @@ s_nop (int ignore ATTRIBUTE_UNUSED)
   md_flush_pending_output ();
 #endif
 
-#ifdef md_cons_align
-  md_cons_align (1);
-#endif
-
   SKIP_WHITESPACE ();
   expression (&exp);
   demand_empty_rest_of_line ();
@@ -3519,10 +3515,6 @@ s_nops (int ignore ATTRIBUTE_UNUSED)
   md_flush_pending_output ();
 #endif
 
-#ifdef md_cons_align
-  md_cons_align (1);
-#endif
-
   SKIP_WHITESPACE ();
   expression (&exp);
   /* Note - this expression is tested for an absolute value in
index c3378353ef7821f33dbb19a6b65d2d7add27d77e..c959492cf65680d9710ad93240fcd97be77d28b7 100644 (file)
@@ -1,2 +1,2 @@
 .*: Assembler messages:
-.*:4: Warning: `constant directive` skips -malign-branch-boundary on `jnc`
+.*:5: Warning: `constant directive` skips -malign-branch-boundary on `jnc`
index 6d9a8893085f3cb92d7c13d2ec1e9ff209172936..f0236a8278d6ffd7e3f4515b7f791fef5dbc5e97 100644 (file)
@@ -27,4 +27,13 @@ Disassembly of section .text:
  +[a-f0-9]+:   f3 c3                   repz ret
  +[a-f0-9]+:   c3                      ret
  +[a-f0-9]+:   f3 ff d0                repz call \*%eax
+
+[a-f0-9]+ <directive>:
+ +[a-f0-9]+:   90                      nop
+ +[a-f0-9]+:   0f ae e8                lfence
+ +[a-f0-9]+:   ff d0                   call   \*%eax
+ +[a-f0-9]+:   8d 76 00                lea    (0x)?0\(%esi\),%esi
+ +[a-f0-9]+:   83 0c 24 00             orl    \$0x0,\(%esp\)
+ +[a-f0-9]+:   0f ae e8                lfence
+ +[a-f0-9]+:   c3                      ret
 #pass
index 0a05e6405b9eeb514787c4f35a4563cfb29a51e8..570a1c6ef357c80399c33cd19a28950a02157605 100644 (file)
@@ -21,3 +21,10 @@ _start:
        call *%eax
        .data
        .byte 0
+
+       .text
+directive:
+       .nop
+       call    *%eax
+       .nops 3
+       ret