On 9/19/26 01:59, Kees Cook wrote: > $(cc-option-bit) returns the flag it was given when the compiler accepts > it, and an empty string otherwise. It was originally only used > internally for machine bit flags, but it is generally useful[1]. > > Rename it to $(cc-option-str), which says what it returns rather than > what it was first used for, and extract the probe logic from the existing > $(cc-option) macro to reuse it. Additionally add support for an optional > fallback, much like the Kbuild cc-option macro. This can be used as: > > config CC_OPT_FOO > def_string "$(cc-option-str,-fnew-option,-fold-option)" > > If the fallback is omitted, it is just an empty string. > > Build tested ARCH=x86_64 defconfig with GCC 16.2.0. > > Assisted-by: LLM > Signed-off-by: Kees Cook <[email protected]>
Tested-by: Julian Braha <[email protected]> Reviewed-by: Julian Braha <[email protected]>

