* [PATCH v2 0/6] scripts/Kconfig.toolchain: Document minimum supported versions for dynamic checks
@ 2026-11-12 0:52 Nathan Chancellor
2026-11-12 0:52 ` [PATCH v2 4/6] riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check Nathan Chancellor
2026-11-12 0:52 ` [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT Nathan Chancellor
0 siblings, 2 replies; 8+ messages in thread
From: Nathan Chancellor @ 2026-11-12 0:52 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, linux-riscv,
Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin
Hi all,
Now that we have a fairly unified location for compiler and linker
feature checks in scripts/Kconfig.toolchain, we should make it easy to
clean up the checks as they become obsolete through minimum supported
version bumps by documenting when they were first supported. I somewhat
modeled this after the documentation in compiler_attributes.h but I did
not want it to be as verbose.
In doing this archaeology, I developed a few prerequisite clean up
patches, mostly around removing code that is practically dead through
minimum versions or adjusting options that are only supported in one
compiler. See the individual patches for the details.
---
Changes in v2:
- Fix versions for a few entries (Julian)
- Add patch fixing check for asm goto with tied outputs in riscv code
- Add patch eliminating check for asm goto with tied outputs, as all
compilers that properly support asm goto with outputs will have
support for tied outputs
- Add links to tools where feature is supported/changed to make future
auditing easier
- Adjust comment format to be a little more succinct
- Reword commit messages accordingly
- Link to v1: https://patch.msgid.link/20261110-kconfig-toolchain-updates-v1-0-6d4fb636290e@kernel.org
---
Nathan Chancellor (6):
scripts/Kconfig.toolchain: Remove CONFIG_CC_HAS_NO_PROFILE_FN_ATTR
scripts/Kconfig.toolchain: Do not dynamically probe '-fno-addrsig'
scripts/Kconfig.toolchain: Clean up '-fno-allow-store-data-races' handling
riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check
Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
scripts/Kconfig.toolchain: Document minimum supported versions for dynamic checks
Makefile | 5 ---
arch/riscv/lib/csum.c | 4 +--
arch/x86/include/asm/uaccess.h | 82 ++++++++++++++++++++----------------------
kernel/gcov/Kconfig | 1 -
scripts/Kconfig.toolchain | 80 +++++++++++++++++++++++++++++++++--------
5 files changed, 107 insertions(+), 65 deletions(-)
---
base-commit: 7f705c0ad1c7cab3d8de99a3a67937bc82fc8481
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261110-kconfig-toolchain-updates-d8b351370a5f
Best regards,
--
Cheers,
Nathan
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 4/6] riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check
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 ` Nathan Chancellor
2026-11-12 11:26 ` Nicolas Schier
2026-11-12 0:52 ` [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT Nathan Chancellor
1 sibling, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2026-11-12 0:52 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, linux-riscv
The defined symbol is CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT, not
CC_HAS_ASM_GOTO_TIED_OUTPUT.
Fixes: 4525462dd0db ("riscv: lib: Check if output in asm goto supported")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Charlie Jenkins <thecharlesjenkins@gmail.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: linux-riscv@lists.infradead.org
---
arch/riscv/lib/csum.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c
index 5d4379768e5d..c2b8986a0d39 100644
--- a/arch/riscv/lib/csum.c
+++ b/arch/riscv/lib/csum.c
@@ -142,7 +142,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
end = (const unsigned long *)(buff + len);
csum = do_csum_common(ptr, end, data);
-#ifdef CC_HAS_ASM_GOTO_TIED_OUTPUT
+#ifdef CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
if (IS_ENABLED(CONFIG_RISCV_ISA_ZBB) &&
IS_ENABLED(CONFIG_TOOLCHAIN_HAS_ZBB) &&
riscv_has_extension_likely(RISCV_ISA_EXT_ZBB)) {
@@ -186,7 +186,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
return csum >> 16;
}
-#endif /* CC_HAS_ASM_GOTO_TIED_OUTPUT */
+#endif /* CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT */
#ifndef CONFIG_32BIT
csum += ror64(csum, 32);
csum >>= 32;
--
2.56.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
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 4/6] riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check Nathan Chancellor
@ 2026-11-12 0:52 ` Nathan Chancellor
2026-11-12 11:34 ` Nicolas Schier
1 sibling, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2026-11-12 0:52 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Charlie Jenkins, Paul Walmsley,
Palmer Dabbelt, linux-riscv
Commit 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs
to workaround clang-13 bug") added CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT to
avoid a bug in clang's asm goto with outputs support when a tied output
was used. The fix in clang was to match GCC's documented behavior.
Now that the minimum supported version of clang has long been bumped
past the version where the fix landed (clang-14), any compiler that
satisfies the dependencies of CONFIG_CC_HAS_ASM_GOTO_OUTPUT will support
tied outputs properly. Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT in
favor of just checking for CONFIG_CC_HAS_ASM_GOTO_OUTPUT directly.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Linus Torvalds <torvalds@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Charlie Jenkins <thecharlesjenkins@gmail.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: linux-riscv@lists.infradead.org
---
arch/riscv/lib/csum.c | 4 +--
arch/x86/include/asm/uaccess.h | 82 ++++++++++++++++++++----------------------
scripts/Kconfig.toolchain | 5 ---
3 files changed, 41 insertions(+), 50 deletions(-)
diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c
index c2b8986a0d39..cd461a7b61a5 100644
--- a/arch/riscv/lib/csum.c
+++ b/arch/riscv/lib/csum.c
@@ -142,7 +142,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
end = (const unsigned long *)(buff + len);
csum = do_csum_common(ptr, end, data);
-#ifdef CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
+#ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
if (IS_ENABLED(CONFIG_RISCV_ISA_ZBB) &&
IS_ENABLED(CONFIG_TOOLCHAIN_HAS_ZBB) &&
riscv_has_extension_likely(RISCV_ISA_EXT_ZBB)) {
@@ -186,7 +186,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
return csum >> 16;
}
-#endif /* CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT */
+#endif /* CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
#ifndef CONFIG_32BIT
csum += ror64(csum, 32);
csum >>= 32;
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index f4700ad6b5ec..64b648e59df0 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -248,6 +248,44 @@ do { \
: [umem] "m" (__m(addr)) \
: : label)
+#define __try_cmpxchg_user_asm(itype, ltype, _ptr, _pold, _new, label) ({ \
+ bool success; \
+ __typeof__(_ptr) _old = (__typeof__(_ptr))(_pold); \
+ __typeof__(*(_ptr)) __old = *_old; \
+ __typeof__(*(_ptr)) __new = (_new); \
+ asm_goto_output("\n" \
+ "1: " LOCK_PREFIX "cmpxchg"itype" %[new], %[ptr]\n"\
+ _ASM_EXTABLE_UA(1b, %l[label]) \
+ : "=@ccz" (success), \
+ [ptr] "+m" (*_ptr), \
+ [old] "+a" (__old) \
+ : [new] ltype (__new) \
+ : "memory" \
+ : label); \
+ if (unlikely(!success)) \
+ *_old = __old; \
+ likely(success); })
+
+#ifdef CONFIG_X86_32
+#define __try_cmpxchg64_user_asm(_ptr, _pold, _new, label) ({ \
+ bool success; \
+ __typeof__(_ptr) _old = (__typeof__(_ptr))(_pold); \
+ __typeof__(*(_ptr)) __old = *_old; \
+ __typeof__(*(_ptr)) __new = (_new); \
+ asm_goto_output("\n" \
+ "1: " LOCK_PREFIX "cmpxchg8b %[ptr]\n" \
+ _ASM_EXTABLE_UA(1b, %l[label]) \
+ : "=@ccz" (success), \
+ "+A" (__old), \
+ [ptr] "+m" (*_ptr) \
+ : "b" ((u32)__new), \
+ "c" ((u32)((u64)__new >> 32)) \
+ : "memory" \
+ : label); \
+ if (unlikely(!success)) \
+ *_old = __old; \
+ likely(success); })
+#endif // CONFIG_X86_32
#else // !CONFIG_CC_HAS_ASM_GOTO_OUTPUT
#ifdef CONFIG_X86_32
@@ -313,48 +351,6 @@ do { \
: [umem] "m" (__m(addr)), \
"0" (err))
-#endif // CONFIG_CC_HAS_ASM_GOTO_OUTPUT
-
-#ifdef CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
-#define __try_cmpxchg_user_asm(itype, ltype, _ptr, _pold, _new, label) ({ \
- bool success; \
- __typeof__(_ptr) _old = (__typeof__(_ptr))(_pold); \
- __typeof__(*(_ptr)) __old = *_old; \
- __typeof__(*(_ptr)) __new = (_new); \
- asm_goto_output("\n" \
- "1: " LOCK_PREFIX "cmpxchg"itype" %[new], %[ptr]\n"\
- _ASM_EXTABLE_UA(1b, %l[label]) \
- : "=@ccz" (success), \
- [ptr] "+m" (*_ptr), \
- [old] "+a" (__old) \
- : [new] ltype (__new) \
- : "memory" \
- : label); \
- if (unlikely(!success)) \
- *_old = __old; \
- likely(success); })
-
-#ifdef CONFIG_X86_32
-#define __try_cmpxchg64_user_asm(_ptr, _pold, _new, label) ({ \
- bool success; \
- __typeof__(_ptr) _old = (__typeof__(_ptr))(_pold); \
- __typeof__(*(_ptr)) __old = *_old; \
- __typeof__(*(_ptr)) __new = (_new); \
- asm_goto_output("\n" \
- "1: " LOCK_PREFIX "cmpxchg8b %[ptr]\n" \
- _ASM_EXTABLE_UA(1b, %l[label]) \
- : "=@ccz" (success), \
- "+A" (__old), \
- [ptr] "+m" (*_ptr) \
- : "b" ((u32)__new), \
- "c" ((u32)((u64)__new >> 32)) \
- : "memory" \
- : label); \
- if (unlikely(!success)) \
- *_old = __old; \
- likely(success); })
-#endif // CONFIG_X86_32
-#else // !CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
#define __try_cmpxchg_user_asm(itype, ltype, _ptr, _pold, _new, label) ({ \
int __err = 0; \
bool success; \
@@ -410,7 +406,7 @@ do { \
*_old = __old; \
likely(__result); })
#endif // CONFIG_X86_32
-#endif // CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
+#endif // CONFIG_CC_HAS_ASM_GOTO_OUTPUT
/* FIXME: this hack is definitely wrong -AK */
struct __large_struct { unsigned long buf[100]; };
diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
index 6520a06a9103..9454ef5294d5 100644
--- a/scripts/Kconfig.toolchain
+++ b/scripts/Kconfig.toolchain
@@ -120,11 +120,6 @@ config CC_HAS_ASM_GOTO_OUTPUT
depends on !GCC_ASM_GOTO_OUTPUT_BROKEN
depends on $(success,echo 'int foo(int x) { asm goto ("": "=r"(x) ::: bar); return x; bar: return 0; }' | $(CC) -x c - -c -o /dev/null)
-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)
-
config TOOLS_SUPPORT_RELR
def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
--
2.56.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 4/6] riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check
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
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Schier @ 2026-11-12 11:26 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, linux-riscv
On Wed, Nov 11, 2026 at 05:52:06PM -0700, Nathan Chancellor wrote:
> The defined symbol is CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT, not
> CC_HAS_ASM_GOTO_TIED_OUTPUT.
>
> Fixes: 4525462dd0db ("riscv: lib: Check if output in asm goto supported")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: Charlie Jenkins <thecharlesjenkins@gmail.com>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: linux-riscv@lists.infradead.org
> ---
> arch/riscv/lib/csum.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Thanks for catching!
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Since 4525462dd0db (v6.7) still supported clang-11: shall we add 'Cc: stable'?
--
Nicolas
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
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
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Schier @ 2026-11-12 11:34 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Charlie Jenkins, Paul Walmsley,
Palmer Dabbelt, linux-riscv
On Wed, Nov 11, 2026 at 05:52:07PM -0700, Nathan Chancellor wrote:
> Commit 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs
> to workaround clang-13 bug") added CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT to
> avoid a bug in clang's asm goto with outputs support when a tied output
> was used. The fix in clang was to match GCC's documented behavior.
>
> Now that the minimum supported version of clang has long been bumped
> past the version where the fix landed (clang-14), any compiler that
> satisfies the dependencies of CONFIG_CC_HAS_ASM_GOTO_OUTPUT will support
> tied outputs properly. Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT in
> favor of just checking for CONFIG_CC_HAS_ASM_GOTO_OUTPUT directly.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
[...]
> diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
> index 6520a06a9103..9454ef5294d5 100644
> --- a/scripts/Kconfig.toolchain
> +++ b/scripts/Kconfig.toolchain
> @@ -120,11 +120,6 @@ config CC_HAS_ASM_GOTO_OUTPUT
> depends on !GCC_ASM_GOTO_OUTPUT_BROKEN
> depends on $(success,echo 'int foo(int x) { asm goto ("": "=r"(x) ::: bar); return x; bar: return 0; }' | $(CC) -x c - -c -o /dev/null)
>
> -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?
--
Nicolas
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 4/6] riscv: checksum: Fix CC_HAS_ASM_GOTO_TIED_OUTPUT check
2026-11-12 11:26 ` Nicolas Schier
@ 2026-11-12 17:21 ` Nathan Chancellor
0 siblings, 0 replies; 8+ messages in thread
From: Nathan Chancellor @ 2026-11-12 17:21 UTC (permalink / raw)
To: Nicolas Schier
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, linux-riscv
On Thu, Nov 12, 2026 at 12:26:32PM +0100, Nicolas Schier wrote:
> On Wed, Nov 11, 2026 at 05:52:06PM -0700, Nathan Chancellor wrote:
> > The defined symbol is CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT, not
> > CC_HAS_ASM_GOTO_TIED_OUTPUT.
> >
> > Fixes: 4525462dd0db ("riscv: lib: Check if output in asm goto supported")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Cc: Charlie Jenkins <thecharlesjenkins@gmail.com>
> > Cc: Paul Walmsley <pjw@kernel.org>
> > Cc: Palmer Dabbelt <palmer@dabbelt.com>
> > Cc: linux-riscv@lists.infradead.org
> > ---
> > arch/riscv/lib/csum.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
>
> Thanks for catching!
>
> Reviewed-by: Nicolas Schier <nsc@kernel.org>
>
> Since 4525462dd0db (v6.7) still supported clang-11: shall we add 'Cc: stable'?
I was a little on the fence about the 'Cc: stable'. On the one hand, it
is definitely a bug and it would totally qualify for stable. On the
other hand, nobody has noticed for almost three years and it is
exercising a new code path. I'll leave that up to you when you apply it
(or the RISC-V people can give their input as well).
--
Cheers,
Nathan
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
2026-11-12 11:34 ` Nicolas Schier
@ 2026-11-12 17:47 ` Nathan Chancellor
2026-11-12 20:12 ` Nicolas Schier
0 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2026-11-12 17:47 UTC (permalink / raw)
To: Nicolas Schier
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Charlie Jenkins, Paul Walmsley,
Palmer Dabbelt, linux-riscv
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.
--
Cheers,
Nathan
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 5/6] Eliminate CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT
2026-11-12 17:47 ` Nathan Chancellor
@ 2026-11-12 20:12 ` Nicolas Schier
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Schier @ 2026-11-12 20:12 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Julian Braha, Nick Desaulniers, Bill Wendling, Justin Stitt,
Arnd Bergmann, Kees Cook, linux-kernel, linux-kbuild, llvm,
Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Charlie Jenkins, Paul Walmsley,
Palmer Dabbelt, linux-riscv
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-11-12 20:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox