Re: [PATCH 1/2] kbuild: Move testing of '-mfentry' back to Makefile from Kconfig
From: Nathan Chancellor
Date: Wed Oct 21 2026 - 14:26:15 EST
On Wed, Oct 21, 2026 at 07:44:16AM -0700, Kees Cook wrote:
>
>
> On October 20, 2026 2:52:18 PM PDT, Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
> >Unlike cc-option in Kbuild, cc-option in Kconfig does not test options
> >with either bit ('-m32' / '-m64') or endianness ('-mbig-endian' /
> >'-mlittle-endian') flags because which flag to use may depend on the
> >result of the configuration stage.
>
> Oooh, yeah... Do we have any silent failures due to this in other places? On x86 I worry we'll see similar problems. Stack protector arg checking comes to mind. I will go see if I can find anything...
I am not sure. I did not look that far, mainly because I thought it
might be hard to audit what is expected vs. unexpected but I guess it
would be easy enough to just dump the result of cc-probe from
scripts/Kconfig.include into a file then look at the tested flag.
On immediate glance across the tree, the s390 Kconfig checks might be
problematic with s390-linux-gcc like '-mfentry' was. Arnd, could the
target for s390 be flipped for the kernel.org GCC toolchains to
s390x-linux-gcc so that '-m64' was the default but the toolchain could
still generate compat code, which seems way more standard for distros?
FWIW, compat support is being killed in the toolchains too, so it feels
like it is worth making this switch even more:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5886bb453a6a010fc218d90c18febf94a1be30d1
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=748bc6a7febf874d84657f538c9d9e3b8153c6e7
The kCFI checks could become problematic if one of the 32/64 or
bi-endian architectures gained asymmetric support in the toolchain but
it was not the target triple that scripts/Makefile.clang uses, but that
feels somewhat unlikely.
Everything else probably does not matter much in practice just due to
lack of use (think 32-bit RISC-V probes when using clang since it has a
64-bit target triple). It does make me a little worried though.
--
Cheers,
Nathan