mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@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
Subject: [PATCH 4/4] scripts/Kconfig.toolchain: Document minimum supported versions for dynamic checks
Date: Tue, 10 Nov 2026 23:42:43 -0600	[thread overview]
Message-ID: <20261110-kconfig-toolchain-updates-v1-4-6d4fb636290e@kernel.org> (raw)
In-Reply-To: <20261110-kconfig-toolchain-updates-v1-0-6d4fb636290e@kernel.org>

To make it easier to clean up unnecessary dynamic checks when the
minimum supported version of a toolchain component is updated, add
comments documenting when features were first supported. Request that
future additions document this as well.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 scripts/Kconfig.toolchain | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
index 26a62b15e9ab..3a9eb8317d59 100644
--- a/scripts/Kconfig.toolchain
+++ b/scripts/Kconfig.toolchain
@@ -1,4 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0-only
+# When adding a new dynamic check (such as {cc,ld}-option{,-str} or testing a
+# small program), please add a comment documenting the first version of the
+# tool that supported the feature being tested. For cc-option{,-str}, note the
+# "beware" comment below.
+
 config CC_VERSION_TEXT
 	string
 	default "$(CC_VERSION_TEXT)"
@@ -118,6 +123,7 @@ config GCC_ASM_GOTO_OUTPUT_BROKEN
 config CC_HAS_ASM_GOTO_OUTPUT
 	def_bool y
 	depends on !GCC_ASM_GOTO_OUTPUT_BROKEN
+	# supported since clang-10 and gcc-11
 	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
@@ -129,6 +135,7 @@ config TOOLS_SUPPORT_RELR
 	def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
 
 config CC_HAS_ASM_INLINE
+	# supported since clang-11 and gcc-9
 	def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null)
 
 config CC_HAS_ASSUME
@@ -161,6 +168,8 @@ config CC_HAS_ASSUME
 #    pitfall.
 
 config CC_OPT_ZERO_INIT_PADDING_BITS
+	# supported since gcc-15. not needed for clang, as it does this by default since clang-20
+	# https://github.com/llvm/llvm-project/commit/7a086e1b2dc05f54afae3591614feede727601fa
 	def_string "$(cc-option-str,-fzero-init-padding-bits=all)"
 
 config CC_OPT_NO_ADDRSIG
@@ -168,12 +177,15 @@ config CC_OPT_NO_ADDRSIG
 	def_string "-fno-addrsig" if CC_IS_CLANG
 
 config CC_OPT_DIAGNOSTICS_SHOW_CONTEXT
+	# supported since gcc-16, not supported by clang
 	def_string "$(cc-option-str,-fdiagnostics-show-context=2)"
 
 config CC_OPT_DIAGNOSTICS_SHOW_INLINING_CHAIN
+	# supported since clang-23. not needed for gcc, as it does this by default
 	def_string "$(cc-option-str,-fdiagnostics-show-inlining-chain)"
 
 config CC_OPT_STRICT_FLEX_ARRAYS
+	# supported since clang-16 and gcc-13
 	def_string "$(cc-option-str,-fstrict-flex-arrays=3)"
 
 config CC_OPT_NO_ALLOW_STORE_DATA_RACES
@@ -181,51 +193,67 @@ config CC_OPT_NO_ALLOW_STORE_DATA_RACES
 	def_string "$(cc-option-str,-fno-allow-store-data-races,--param=allow-store-data-races=0)" if CC_IS_GCC
 
 config CC_HAS_MNOP_MCOUNT
+	# supported since clang-10 and gcc-9 but option is architecture specific
 	def_bool $(cc-option,-mnop-mcount)
 
 config LD_OPT_FORCE_GROUP_ALLOCATION
+	# supported since ld.lld 19 and GNU ld 2.29
 	def_string "$(ld-option-str,--force-group-allocation)"
 
 config LD_OPT_NO_WARN_RWX_SEGMENTS
+	# supported since GNU ld 2.39, not supported by ld.lld
 	def_string "$(ld-option-str,--no-warn-rwx-segments)"
 
 config CC_OPT_WNO_ADDRESS_OF_PACKED_MEMBER
+	# supported since clang-4 and gcc-9
 	def_string "$(cc-option-str,-Wno-address-of-packed-member)"
 
 config CC_OPT_WNO_FORMAT_OVERFLOW_NON_KPRINTF
+	# supported since clang-18, not needed for gcc
 	def_string "$(cc-option-str,-Wno-format-overflow-non-kprintf)"
 
 config CC_OPT_WNO_FORMAT_TRUNCATION_NON_KPRINTF
+	# supported since clang-18, not needed for gcc
 	def_string "$(cc-option-str,-Wno-format-truncation-non-kprintf)"
 
 config CC_OPT_WNO_DEFAULT_CONST_INIT_UNSAFE
+	# supported since clang-21, not needed for gcc
 	def_string "$(cc-option-str,-Wno-default-const-init-unsafe)"
 
 config CC_OPT_WNO_DANGLING_POINTER
+	# supported since gcc-12, not needed for clang
 	def_string "$(cc-option-str,-Wno-dangling-pointer)"
 
 config CC_OPT_WVLA_LARGER_THAN
+	# supported since gcc-7, not supported by clang
 	def_string "$(cc-option-str,-Wvla-larger-than=1)"
 
 config CC_HAS_WSTRINGOP_OVERFLOW
+	# supported since gcc-7, not supported by clang
 	def_bool $(cc-option,-Wstringop-overflow)
 
 config CC_OPT_WNO_UNTERMINATED_STRING_INITIALIZATION
+	# supported since gcc-15 and clang-21
 	def_string "$(cc-option-str,-Wno-unterminated-string-initialization)"
 
 config CC_OPT_WERROR_DESIGNATED_INIT
+	# supported since gcc-5, not supported by clang
 	def_string "$(cc-option-str,-Werror=designated-init)"
 
 config CC_OPT_WENUM_CONVERSION
+	# supported since clang-3.2 and gcc-10
 	def_string "$(cc-option-str,-Wenum-conversion)"
 
 config CC_OPT_WNO_PACKED_NOT_ALIGNED
+	# supported since gcc-8, not supported by clang
 	def_string "$(cc-option-str,-Wno-packed-not-aligned)"
 
 config CC_OPT_WNO_FORMAT_OVERFLOW
+	# supported since gcc-7 and clang-18
 	def_string "$(cc-option-str,-Wno-format-overflow)"
 
 config CC_OPT_WNO_STRINGOP_TRUNCATION
+	# supported since gcc-8, not supported by clang
 	def_string "$(cc-option-str,-Wno-stringop-truncation)"
 
 config CC_HAS_COUNTED_BY
@@ -252,14 +280,18 @@ config CC_HAS_BROKEN_COUNTED_BY_REF
 	default y if CC_IS_CLANG && CLANG_VERSION < 220100
 
 config CC_HAS_ALLOC_TOKEN
+	# supported since clang-22, not supported by gcc
 	def_bool $(cc-option,-falloc-token-max=123)
 
 config CC_HAS_MULTIDIMENSIONAL_NONSTRING
+	# supported since gcc-15 and clang-21
 	def_bool $(success,echo 'char tag[][4] __attribute__((__nonstring__)) = { };' | $(CC) $(CLANG_FLAGS) -x c - -c -o /dev/null -Werror)
 
 config CC_OPT_INLINE_MEMSET
 	string
+	# supported since gcc-14
 	default "-finline-stringops=memset" if $(cc-option,-finline-stringops=memset)
+	# supported since clang-22
 	default "-mllvm -max-store-memset=4294967294" if $(cc-option,-mllvm -max-store-memset=4294967294)
 
 config LD_CAN_USE_KEEP_IN_OVERLAY

-- 
2.56.0


      parent reply	other threads:[~2026-11-11  5:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  5:42 [PATCH 0/4] " Nathan Chancellor
2026-11-11  5:42 ` [PATCH 1/4] scripts/Kconfig.toolchain: Remove CONFIG_CC_HAS_NO_PROFILE_FN_ATTR Nathan Chancellor
2026-11-11  5:42 ` [PATCH 2/4] scripts/Kconfig.toolchain: Do not dynamically probe '-fno-addrsig' Nathan Chancellor
2026-11-11  5:42 ` [PATCH 3/4] scripts/Kconfig.toolchain: Clean up '-fno-allow-store-data-races' handling Nathan Chancellor
2026-11-11  5:42 ` Nathan Chancellor [this message]

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=20261110-kconfig-toolchain-updates-v1-4-6d4fb636290e@kernel.org \
    --to=nathan@kernel.org \
    --cc=arnd@arndb.de \
    --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=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=ndesaulniers@google.com \
    --cc=nsc@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

all inboxes | Powered by JetHome®