On 11/11/26 05:42, Nathan Chancellor wrote: > 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. Love, love, love this! I tested the bounds and replicated nearly all of your results, but had a few notes: > > Signed-off-by: Nathan Chancellor > --- > 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 'asm goto' failed for me with clang 10. Seems it was added with clang 11 [1] > 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)" Clang 15 supports '-fstrict-flex-arrays' [1] so the check seemingly passed, but support for level 3 wasn't actually added until clang 16. I think this needs a: 'depends on !CC_IS_CLANG || CLANG_VERSION >= 160000' so the option evaluates as empty string when these deps are unmet. > > 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) '-mnop-mcount' worked for me on x86 with gcc 5 [3], but it seems s390 support came later in v9 [4] > > 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 > [1] https://releases.llvm.org/11.0.0/tools/clang/docs/LanguageExtensions.html [2] https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#major-new-features [3] https://gcc.gnu.org/gcc-5/changes.html#x86 [4] https://gcc.gnu.org/gcc-9/changes.html#s390 - Julian Braha