public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Nick Clifton <nickc@redhat.com>
Subject: [PATCH 3/6] gas: no md_cons_align() for .nop{,s}
Date: Fri, 24 Nov 2023 10:04:17 +0100	[thread overview]
Message-ID: <8857c2de-39b6-43c7-93d9-43554ef317c3@suse.com> (raw)
In-Reply-To: <94626e2b-0e73-4267-9c80-cb25e1dbab9b@suse.com>

.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().
---
I also consider it at least a little suspicious that all common code
invocations of md_cons_align() have an argument of 1 passed to it:
What's the point of that argument then? Target specific code invoking
their own target hook can surely deal with passing appropriate arguments
other than 1.

--- a/gas/read.c
+++ b/gas/read.c
@@ -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
--- a/gas/testsuite/gas/i386/align-branch-6.e
+++ b/gas/testsuite/gas/i386/align-branch-6.e
@@ -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`
--- a/gas/testsuite/gas/i386/lfence-byte.d
+++ b/gas/testsuite/gas/i386/lfence-byte.d
@@ -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
--- a/gas/testsuite/gas/i386/lfence-byte.s
+++ b/gas/testsuite/gas/i386/lfence-byte.s
@@ -21,3 +21,10 @@ _start:
 	call *%eax
 	.data
 	.byte 0
+
+	.text
+directive:
+	.nop
+	call	*%eax
+	.nops 3
+	ret


  reply	other threads:[~2023-11-24  9:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24  9:02 [PATCH 0/6] correct and further utilize x86'es last-insn tracking Jan Beulich
2023-11-24  9:03 ` [PATCH 1/6] x86: last-insn recording should be per-section Jan Beulich
2023-11-24  9:04   ` Jan Beulich [this message]
2023-11-24 13:29   ` Jan Beulich
2023-11-24  9:03 ` [PATCH 2/6] x86: suppress optimization after potential non-insn Jan Beulich
2023-11-24  9:05 ` [PATCH 4/6] x86: i386_cons_align() badly affects diagnostics Jan Beulich
2023-11-24  9:05 ` [PATCH 5/6] x86: adjust NOP generation after potential non-insn Jan Beulich
2023-11-24  9:06 ` [PATCH 6/6] gas: drop unused fields from struct segment_info_struct Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8857c2de-39b6-43c7-93d9-43554ef317c3@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).