string
default "arch/x86/configs/x86_64_defconfig"
-config INDIRECT_THUNK
+config CC_HAS_INDIRECT_THUNK
def_bool $(cc-option,-mindirect-branch-register)
+config INDIRECT_THUNK
+ def_bool y
+ depends on CC_HAS_INDIRECT_THUNK
+
config HAS_AS_CET_SS
# binutils >= 2.29 or LLVM >= 6
def_bool $(as-instr,wrssq %rax$(comma)0;setssbsy)
# SSE setup for variadic function calls.
CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup)
-# Compile with thunk-extern, indirect-branch-register if avaiable.
-CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch=thunk-extern
-CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch-register
-CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables
+ifeq ($(CONFIG_INDIRECT_THUNK),y)
+# Compile with gcc thunk-extern, indirect-branch-register if available.
+CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch=thunk-extern
+CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch-register
+CFLAGS-$(CONFIG_CC_IS_GCC) += -fno-jump-tables
+endif
# If supported by the compiler, reduce stack alignment to 8 bytes. But allow
# this to be overridden elsewhere.