[PATCH v2 1/2] x86/build: Remove -ffreestanding on i386 with GCC

Kees Cook kees at kernel.org
Sat Mar 8 04:29:25 UTC 2025


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 at kernel.org>
---
Cc: Nathan Chancellor <nathan at kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml at gmail.com>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Borislav Petkov <bp at alien8.de>
Cc: Dave Hansen <dave.hansen at linux.intel.com>
Cc: x86 at kernel.org
Cc: "H. Peter Anvin" <hpa at zytor.com>
---
 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




More information about the Linux-security-module-archive mailing list