Re: PROBLEM: 5.11.0-rc7 fails to compile with error: ‘-mindirect-branch’ and ‘-fcf-protection’ are not compatible

From: AC
Date: Mon Feb 08 2021 - 11:59:40 EST


That did fix it, thank you!

On February 8, 2021 7:12:27 AM EST, Borislav Petkov <bp@xxxxxxx> wrote:
>On Sun, Feb 07, 2021 at 07:40:32PM -0500, Stuart Little wrote:
>> > On Sun, Feb 07, 2021 at 06:31:22PM -0500, Stuart Little wrote:
>> > > I am trying to compile on an x86_64 host for a 32-bit system; my
>config is at
>> > >
>> > > https://termbin.com/v8jl
>> > >
>> > > I am getting numerous errors of the form
>> > >
>> > > ./include/linux/kasan-checks.h:17:1: error: ‘-mindirect-branch’
>and ‘-fcf-protection’ are not compatible
>
>Does this fix it?
>
>---
>
>diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>index 5857917f83ee..30920d70b48b 100644
>--- a/arch/x86/Makefile
>+++ b/arch/x86/Makefile
>@@ -50,6 +50,9 @@ export BITS
> KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
> KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
>
>+# Intel CET isn't enabled in the kernel
>+KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
>+
> ifeq ($(CONFIG_X86_32),y)
> BITS := 32
> UTS_MACHINE := i386
>@@ -120,9 +123,6 @@ else
>
> KBUILD_CFLAGS += -mno-red-zone
> KBUILD_CFLAGS += -mcmodel=kernel
>-
>- # Intel CET isn't enabled in the kernel
>- KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
> endif
>
> ifdef CONFIG_X86_X32