Re: [PATCH 1/2] kbuild: Move testing of '-mfentry' back to Makefile from Kconfig

From: Kees Cook

Date: Fri Oct 30 2026 - 18:30:04 EST


On Tue, Oct 20, 2026 at 02:52:18PM -0700, Nathan Chancellor wrote:
> Ricardo reported another issue with moving this check from Kbuild to
> Kconfig, as '-mfentry' is not supported for x86_32 without '-fno-pic',
> which affects GCC builds that are configured with PIE enabled by
> default. arch/x86/Makefile adds '-fno-pic' to KBUILD_CFLAGS, so this
> works properly in Kbuild.

FWIW, Debian's i686-linux-gnu-gcc 16.2.0 hits this too: ARCH=i386
allmodconfig fails at scripts/mod/empty.o with "'-pg' without '-mfentry'
may be unreliable with shrink wrapping" under -Werror. With this patch
on top of Linus's tree, the whole build is clean.

Tested-by: Kees Cook <kees@xxxxxxxxxx>

--
Kees Cook