Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Nicolas Schier <nsc@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Julian Braha <julianbraha@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Arnd Bergmann <arnd@arndb.de>, Kees Cook <kees@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	llvm@lists.linux.dev,
	Linus Torvalds <torvalds@linuxfoundation.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Charlie Jenkins <thecharlesjenkins@gmail.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
Date: Thu, 12 Nov 2026 21:12:16 +0100	[thread overview]
Message-ID: <avYdoI-g8YPwNwUG@levanger> (raw)
In-Reply-To: <20261112174753.GC4107043@ax162>

On Thu, Nov 12, 2026 at 10:47:53AM -0700, Nathan Chancellor wrote:
> On Thu, Nov 12, 2026 at 12:34:50PM +0100, Nicolas Schier wrote:
> > On Wed, Nov 11, 2026 at 05:52:07PM -0700, Nathan Chancellor wrote:
> > > -config CC_HAS_ASM_GOTO_TIED_OUTPUT
> > > -	depends on CC_HAS_ASM_GOTO_OUTPUT
> > > -	# Detect buggy gcc and clang, fixed in gcc-11 clang-14.
> > > -	def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
> > 
> > The comments reads as if gcc 8 to 10 are affected.  Is the comment
> > somehow misleading, or should we still keep this until gcc-10 is the
> > minimum gcc version?
> 
> It is a little misleading. GCC 11 was the first version that supported
> asm goto with outputs, so this program will not compile with GCC 8 to 10
> as a result:
> 
>   <stdin>: In function 'foo':
>   <stdin>:1:51: error: expected ':' before string constant
> 
> The bug that it is trying to trigger was fixed during the GCC 11
> development cycle between the initial asm goto with outputs commit and
> the final release. As a result, for GCC, if it supports asm goto with
> outputs, it supports tied outputs in the expected manner.
> 
> This test was mostly to catch buggy versions of clang, as asm goto with
> outputs was first shipped in clang-11 but using tied outputs breaks the
> build until they were fixed to be compatible with GCC in clang-14:
> 
>   <stdin>:1:29: error: invalid operand in inline asm: '.long (${1:l}) - .'
>   int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }
>                               ^
>   <stdin>:1:29: error: unknown token in expression in '.long' directive
>   <inline asm>:1:9: note: instantiated into assembly here
>           .long () - .
>                  ^
>   2 errors generated.
> 
> So if the compiler results in CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y, we know
> that CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y will be present as well.

ah ok, thanks for clarification!

Reviewed-by: Nicolas Schier <nsc@kernel.org>

-- 
Nicolas

  reply	other threads:[~2026-11-12 20:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  0:52 [PATCH v2 0/6] scripts/Kconfig.toolchain: Document minimum supported versions for dynamic checks Nathan Chancellor
2026-11-12  0:52 ` [PATCH v2 1/6] scripts/Kconfig.toolchain: Remove CONFIG_CC_HAS_NO_PROFILE_FN_ATTR Nathan Chancellor
2026-11-12 11:15   ` Nicolas Schier
2026-11-12  0:52 ` [PATCH v2 2/6] scripts/Kconfig.toolchain: Do not dynamically probe '-fno-addrsig' Nathan Chancellor
2026-11-12 11:21   ` Nicolas Schier
2026-11-12  0:52 ` [PATCH v2 3/6] scripts/Kconfig.toolchain: Clean up '-fno-allow-store-data-races' handling Nathan Chancellor
2026-11-12 11:25   ` Nicolas Schier
2026-11-12  0:52 ` [PATCH v2 4/6] riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check Nathan Chancellor
2026-11-12 11:26   ` Nicolas Schier
2026-11-12 17:21     ` Nathan Chancellor
2026-11-12  0:52 ` [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT Nathan Chancellor
2026-11-12 11:34   ` Nicolas Schier
2026-11-12 17:47     ` Nathan Chancellor
2026-11-12 20:12       ` Nicolas Schier [this message]
2026-11-12  0:52 ` [PATCH v2 6/6] scripts/Kconfig.toolchain: Document minimum supported versions for dynamic checks Nathan Chancellor
2026-11-12 11:42   ` Nicolas Schier

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=avYdoI-g8YPwNwUG@levanger \
    --to=nsc@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=julianbraha@gmail.com \
    --cc=justinstitt@google.com \
    --cc=kees@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=tglx@kernel.org \
    --cc=thecharlesjenkins@gmail.com \
    --cc=torvalds@linuxfoundation.org \
    --cc=x86@kernel.org \
    /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