archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <>
To: Nick Desaulniers <>
Cc: Josh Poimboeuf <>,
	Borislav Petkov <>, Vasily Gorbik <>,
	Linus Torvalds <>,
	Ingo Molnar <>,
	Dave Hansen <>,
	Thomas Gleixner <>,
	Peter Zijlstra <>,
	Luc Van Oostenryck <>,,,,,
	kernel test robot <>,
	Nathan Chancellor <>,,
Subject: Re: [PATCH] objtool: prefer memory clobber & %= to volatile & __COUNTER__
Date: Wed, 26 Jan 2022 05:13:55 -0600	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>


On Tue, Jan 25, 2022 at 06:12:20PM -0800, Nick Desaulniers wrote:
> Andrew clarified (thanks Andrew!) that %= can't be used as I imagined
> and that I think was alluded to in
> commit 3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()")
> which is fine, so I'll just need to keep usage of __COUNTER__.

Aha.  Yes, %= *outputs* a unique number.  Before the assembler output
is written %= is just a string (like any other piece of output
template).  The output template is used for three things:

1) Inline assembler statements with different output templates are not
considered identical;
2) Newlines and assembler statement separators (semicolons for most
assembler dialects) are used to estimate the size of the machine code
generated.  This is a pessimistic estimate, but within reason: for
example you can write a million byte output with just a few characters
of input, if you want to sabotage yourself;
3) The output template is used at output time.

The mentioned commit's message says "unfortunately older versions of GCC
don't support it" which is mistaken.

If you want two identical inline asm statements to not be considered
identical by the compiler, you have to make them not identical.  Like by
using __COUNTER__ for example, yes :-)


  reply	other threads:[~2022-01-26 11:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
     [not found] ` <YeQei0xNzMq7bFdg@zn.tnic>
     [not found]   ` <20220118192256.jzk5dnceeusq7x7u@treble>
     [not found]     ` <20220118230120.pivvson7qekfiqic@treble>
2022-01-24 23:26       ` [PATCH] objtool: prefer memory clobber & %= to volatile & __COUNTER__ Nick Desaulniers
2022-01-24 23:38         ` Nick Desaulniers
2022-01-25 18:49           ` Borislav Petkov
2022-01-25 23:31         ` Segher Boessenkool
2022-01-26  0:59           ` Nick Desaulniers
2022-01-26  2:12             ` Nick Desaulniers
2022-01-26 11:13               ` Segher Boessenkool [this message]
2022-01-31 20:45           ` Nick Desaulniers
2022-01-31 22:13             ` Segher Boessenkool

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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 NNTP newsgroup(s).