GCC Lands s390 Compiler-Side Changes For Spectre V2

Landing this week in the GNU Compiler Collection (GCC) code-base was the s390 architecture specific code for disabling prediction of indirect branches as part of its Spectre Variant Two work on IBM Z.
As mentioned in the s390 kernel article, the s390 approach due to its architecture is making use of the execute instruction rather than a return instruction, dubbing the mitigation technique "Expoline" rather than "Retpoline" for AMD/Intel hardware.
The new s390 compiler switches are formatted similarly to the x86 switches:
-mindirect-branch-jump=(keep|thunk|thunk-extern|thunk-inline)
-mindirect-branch-call=(keep|thunk|thunk-extern)
-mfunction-return-reg=(keep|thunk|thunk-extern)
-mfunction-return-mem=(keep|thunk|thunk-extern)
More details via this commit.
2 Comments