summaryrefslogtreecommitdiffstats
path: root/arch/x86/Makefile
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@oracle.com>2018-11-02 01:45:41 -0700
committerThomas Gleixner <tglx@linutronix.de>2018-11-28 11:57:03 +0100
commit4cd24de3a0980bf3100c9dcb08ef65ca7c31af48 (patch)
treee8358f10ec5689cdda1d7ad33491c607d15766c6 /arch/x86/Makefile
parent2e6e902d185027f8e3cb8b7305238f7e35d6a436 (diff)
downloadlinux-0-day-4cd24de3a0980bf3100c9dcb08ef65ca7c31af48.tar.gz
linux-0-day-4cd24de3a0980bf3100c9dcb08ef65ca7c31af48.tar.xz
x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support
Since retpoline capable compilers are widely available, make CONFIG_RETPOLINE hard depend on the compiler capability. Break the build when CONFIG_RETPOLINE is enabled and the compiler does not support it. Emit an error message in that case: "arch/x86/Makefile:226: *** You are building kernel with non-retpoline compiler, please update your compiler.. Stop." [dwmw: Fail the build with non-retpoline compiler] Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: Borislav Petkov <bp@suse.de> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Michal Marek <michal.lkml@markovi.net> Cc: <srinivas.eeda@oracle.com> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/cca0cb20-f9e2-4094-840b-fb0f8810cd34@default
Diffstat (limited to 'arch/x86/Makefile')
-rw-r--r--arch/x86/Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 88398fdf81291..f5d7f41345249 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -220,9 +220,10 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
# Avoid indirect branches in kernel to deal with Spectre
ifdef CONFIG_RETPOLINE
-ifneq ($(RETPOLINE_CFLAGS),)
- KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
+ifeq ($(RETPOLINE_CFLAGS),)
+ $(error You are building kernel with non-retpoline compiler, please update your compiler.)
endif
+ KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
endif
archscripts: scripts_basic