]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/retpoline: split retpoline compiler support into separate option
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 18 Feb 2022 14:34:14 +0000 (15:34 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 21 Feb 2022 18:17:56 +0000 (18:17 +0000)
Keep the previous option as a way to signal generic retpoline support
regardless of the underlying compiler, while introducing a new
CC_HAS_INDIRECT_THUNK that signals whether the underlying compiler
supports retpoline.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/Kconfig
xen/arch/x86/arch.mk

index b4abfca46f6af425d377e1fbbaafd0924d4587e7..fe89fa72749eef188c17f1e9cdd1a35adfd9caf8 100644 (file)
@@ -32,9 +32,13 @@ config ARCH_DEFCONFIG
        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)
index bfd5eaa35f2549840c8bb361e3353d759e5f45d9..15d0cbe4874a4b036094fa622a0581d9db444676 100644 (file)
@@ -42,10 +42,12 @@ CFLAGS += -mno-red-zone -fpic
 # 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.