Skip to content

Commit 25896d0

Browse files
masahir0yIngo Molnar
authored andcommitted
x86/build: Fix compiler support check for CONFIG_RETPOLINE
It is troublesome to add a diagnostic like this to the Makefile parse stage because the top-level Makefile could be parsed with a stale include/config/auto.conf. Once you are hit by the error about non-retpoline compiler, the compilation still breaks even after disabling CONFIG_RETPOLINE. The easiest fix is to move this check to the "archprepare" like this commit did: 829fe4a ("x86: Allow generating user-space headers without a compiler") Reported-by: Meelis Roos <mroos@linux.ee> Tested-by: Meelis Roos <mroos@linux.ee> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Zhenzhong Duan <zhenzhong.duan@oracle.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com> Fixes: 4cd24de ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support") Link: http://lkml.kernel.org/r/1543991239-18476-1-git-send-email-yamada.masahiro@socionext.com Link: https://lkml.org/lkml/2018/12/4/206 Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 182ddd1 commit 25896d0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/x86/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
220220

221221
# Avoid indirect branches in kernel to deal with Spectre
222222
ifdef CONFIG_RETPOLINE
223-
ifeq ($(RETPOLINE_CFLAGS),)
224-
$(error You are building kernel with non-retpoline compiler, please update your compiler.)
225-
endif
226223
KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
227224
endif
228225

@@ -307,6 +304,13 @@ ifndef CC_HAVE_ASM_GOTO
307304
@echo Compiler lacks asm-goto support.
308305
@exit 1
309306
endif
307+
ifdef CONFIG_RETPOLINE
308+
ifeq ($(RETPOLINE_CFLAGS),)
309+
@echo "You are building kernel with non-retpoline compiler." >&2
310+
@echo "Please update your compiler." >&2
311+
@false
312+
endif
313+
endif
310314

311315
archclean:
312316
$(Q)rm -rf $(objtree)/arch/i386

0 commit comments

Comments
 (0)