diff options
author | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2018-03-20 11:11:57 +0100 |
---|---|---|
committer | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2018-05-29 17:59:08 +0200 |
commit | 5529b388135b4f8bf9681702b34c805040aae557 (patch) | |
tree | 6a6faae5d89f686eb46112a3c07d58018b33cd44 | |
parent | 30492ea4d4928454063a446175da5c35b5c30980 (diff) |
x86: Move x86-retpoline CFLAGS into x86 Makefile.
This patch moves the definition of RETPOLINE_CFLAGS*
into the arch specific Makefile to allow other architectures
to define their own retpoline CFLAGS.
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | arch/x86/Makefile | 5 |
2 files changed, 12 insertions, 0 deletions
@@ -496,6 +496,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) export RETPOLINE_CFLAGS +# check for 'asm goto' +ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) + CC_HAVE_ASM_GOTO := 1 + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO +endif + ifeq ($(config-targets),1) # =========================================================================== # *config targets only - make sure prerequisites are updated, and descend diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 1c4d012550ec..33aab24c7b2c 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -239,6 +239,11 @@ KBUILD_CFLAGS += -Wno-sign-compare # KBUILD_CFLAGS += -fno-asynchronous-unwind-tables +RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register +RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk +RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) +export RETPOLINE_CFLAGS + # Avoid indirect branches in kernel to deal with Spectre ifdef CONFIG_RETPOLINE ifneq ($(RETPOLINE_CFLAGS),) |