x86: Use -mindirect-branch-cs-prefix for RETPOLINE builds
PATCH 1/1 x86: Use -mindirect-branch-cs-prefix for RETPOLINE builds
In order to further enable commit:
bbe2df3f6b6d ("x86/alternative: Try inline spectre_v2=retpoline,amd")
add the new GCC flag -mindirect-branch-cs-prefix:
https://gcc.gnu.org/g:2196a681d7810ad8b227bf983f38ba716620545e
to RETPOLINE=y builds. This should allow fully inlining retpoline,amd for GCC builds.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -690,6 +690,7 @@ endif ifdef CONFIG_CC_IS_GCC RETPOLINE_CFLAGS := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register) +RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch-cs-prefix) RETPOLINE_VDSO_CFLAGS := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register) endif ifdef CONFIG_CC_IS_CLANG
Quoted 4 lines · Peter Zijlstra
In order to further enable commit:
Quoted 8 lines
bbe2df3f6b6d("x86/alternative: Try inline spectre_v2=retpoline,amd")add the new GCC flag -mindirect-branch-cs-prefix:
https://gcc.gnu.org/g:2196a681d7810ad8b227bf983f38ba716620545e
to RETPOLINE=y builds. This should allow fully inlining retpoline,amd for GCC builds.
Do you mind adding the following link tags:
If the feature would be helpful to implement in Clang, would you mind keeping the cc-option, but moving the check outside of the ifdef CONFIG_CC_IS_GCC block? That way, we don't need to revisit the Makefile?
(Tangential: I wonder why RETPOLINE_CFLAGS aren't defined in arch/x86/Makefile; they seem to be x86 specific at the moment).
With the above link tags, and with or without moving this outside the gcc-specific guard:
Quoted 18 lines
Signed-off-by Peter Zijlstra (Intel) <[email protected]>--- Makefile | 1 + 1 file changed, 1 insertion(+)Makefile +1
-0@@ -690,6 +690,7 @@ endif ifdef CONFIG_CC_IS_GCC RETPOLINE_CFLAGS := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register) +RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch-cs-prefix) RETPOLINE_VDSO_CFLAGS := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register) endif ifdef CONFIG_CC_IS_CLANG
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 11 lines · Nick Desaulniers
Quoted 10 lines · Peter Zijlstra
In order to further enable commit:
bbe2df3f6b6d("x86/alternative: Try inline spectre_v2=retpoline,amd")add the new GCC flag -mindirect-branch-cs-prefix:
https://gcc.gnu.org/g:2196a681d7810ad8b227bf983f38ba716620545e
Quoted 8 lines
Quoted 2 lines
to RETPOLINE=y builds. This should allow fully inlining retpoline,amd for GCC builds.
Do you mind adding the following link tags:
My scripts will strip that, they only like to have a Link to to the actual email as posted. I can put in the URLs, the first is already in the Changelog.
Quoted 4 lines
If the feature would be helpful to implement in Clang, would you mind keeping the cc-option, but moving the check outside of the
ifdef CONFIG_CC_IS_GCCblock? That way, we don't need to revisit theMakefile?
I was thinking that clang would want to name it differently to be consistent with their own retpoline flags, something like:
-mretpoline-cs-prefix
Quoted 2 lines
(Tangential: I wonder why
RETPOLINE_CFLAGSaren't defined inarch/x86/Makefile; they seem to be x86 specific at the moment).
Yeah, I think there was hoping that other archs would find it useful, but so far x86 is the only one having grown them things. I can move them I suppose. If ever another arch grows them we can reconsider.
Quoted 3 lines
With the above link tags, and with or without moving this outside the gcc-specific guard:
Acked-by Nick Desaulniers <[email protected]>
Thanks, let me repost as two patches.