[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/3] x86/clang: add retpoline support
On 16.02.2022 10:02, Roger Pau Monne wrote: > Detect whether the compiler supports clang retpoline option and enable > by default if available, just like it's done for gcc. > > Note clang already disables jump tables when retpoline is enabled, so > there's no need to also pass the fno-jump-tables parameter. That's one of the secondary gcc side arrangements. What about the other (-mindirect-branch-register)? > Reported-by: Jan Beulich <JBeulich@xxxxxxxx> That's Andrew, not me? Jan > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> > --- > xen/arch/x86/Kconfig | 5 ++++- > xen/arch/x86/arch.mk | 3 +++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig > index 2cd713724f..fe00b4598b 100644 > --- a/xen/arch/x86/Kconfig > +++ b/xen/arch/x86/Kconfig > @@ -35,8 +35,11 @@ config ARCH_DEFCONFIG > config GCC_INDIRECT_THUNK > def_bool $(cc-option,-mindirect-branch-register) > > +config CLANG_INDIRECT_THUNK > + def_bool $(cc-option,-mretpoline-external-thunk) > + > config INDIRECT_THUNK > - depends on GCC_INDIRECT_THUNK > + depends on GCC_INDIRECT_THUNK || CLANG_INDIRECT_THUNK > def_bool y > > config HAS_AS_CET_SS > diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk > index 2da4bdb1ed..f2aa2a515f 100644 > --- a/xen/arch/x86/arch.mk > +++ b/xen/arch/x86/arch.mk > @@ -47,6 +47,9 @@ CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += > -mindirect-branch=thunk-extern > CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -mindirect-branch-register > CFLAGS-$(CONFIG_GCC_INDIRECT_THUNK) += -fno-jump-tables > > +# Enable clang retpoline support if available. > +CFLAGS-$(CONFIG_CLANG_INDIRECT_THUNK) += -mretpoline-external-thunk > + > # If supported by the compiler, reduce stack alignment to 8 bytes. But allow > # this to be overridden elsewhere. > $(call cc-option-add,CFLAGS_stack_boundary,CC,-mpreferred-stack-boundary=3)
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |