diff options
Diffstat (limited to 'arch/x86/Makefile')
-rw-r--r-- | arch/x86/Makefile | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 3e73bc255e4e..e98f8e2e3708 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -230,6 +230,16 @@ KBUILD_CFLAGS += -Wno-sign-compare # KBUILD_CFLAGS += -fno-asynchronous-unwind-tables +# Avoid indirect branches in kernel to deal with Spectre +ifdef CONFIG_RETPOLINE + RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register) + ifneq ($(RETPOLINE_CFLAGS),) + KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE + else + $(warning CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.) + endif +endif + archscripts: scripts_basic $(Q)$(MAKE) $(build)=arch/x86/tools relocs |