Re: [PATCH v2 1/2] x86/build: Remove -ffreestanding on i386 with GCC
From: Nathan Chancellor
Date: Sat Mar 08 2025 - 04:18:00 EST
On Fri, Mar 07, 2025 at 08:29:25PM -0800, Kees Cook wrote:
> The use of -ffreestanding is a leftover that is only needed for certain
> versions of Clang. Adjust this to be Clang-only. A later patch will make
> this a versioned check.
>
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
This could also adjust the comment but it is probably not that big of a
deal since the "temporary" is already pretty stale.
Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> ---
> Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
> Cc: Nick Desaulniers <nick.desaulniers+lkml@xxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> ---
> arch/x86/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 5b773b34768d..d25ed25fb7d9 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -137,8 +137,10 @@ ifeq ($(CONFIG_X86_32),y)
> include $(srctree)/arch/x86/Makefile_32.cpu
> KBUILD_CFLAGS += $(cflags-y)
>
> + ifeq ($(CONFIG_CC_IS_CLANG),y)
> # temporary until string.h is fixed
> KBUILD_CFLAGS += -ffreestanding
> + endif
>
> ifeq ($(CONFIG_STACKPROTECTOR),y)
> ifeq ($(CONFIG_SMP),y)
> --
> 2.34.1
>