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:

829fe4aa9ac1 ("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: 4cd24de3a098 ("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>

authored by Masahiro Yamada and committed by Ingo Molnar 25896d07 182ddd16

Changed files
+7 -3
arch
x86
+7 -3
arch/x86/Makefile
··· 220 220 221 221 # Avoid indirect branches in kernel to deal with Spectre 222 222 ifdef CONFIG_RETPOLINE 223 - ifeq ($(RETPOLINE_CFLAGS),) 224 - $(error You are building kernel with non-retpoline compiler, please update your compiler.) 225 - endif 226 223 KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) 227 224 endif 228 225 ··· 303 306 ifndef CC_HAVE_ASM_GOTO 304 307 @echo Compiler lacks asm-goto support. 305 308 @exit 1 309 + endif 310 + ifdef CONFIG_RETPOLINE 311 + ifeq ($(RETPOLINE_CFLAGS),) 312 + @echo "You are building kernel with non-retpoline compiler." >&2 313 + @echo "Please update your compiler." >&2 314 + @false 315 + endif 306 316 endif 307 317 308 318 archclean: