]> gcc.gnu.org Git - gcc.git/commit
x86: Add -mindirect-branch-cs-prefix
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 27 Oct 2021 13:27:15 +0000 (06:27 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 18 Nov 2021 16:25:11 +0000 (08:25 -0800)
commit2196a681d7810ad8b227bf983f38ba716620545e
tree3da7f11755f19cb140029786544dfb10e45e34c3
parentca243ada71656651a8753e88164a1f0f019be1c3
x86: Add -mindirect-branch-cs-prefix

Add -mindirect-branch-cs-prefix to add CS prefix to call and jmp to
indirect thunk with branch target in r8-r15 registers so that the call
and jmp instruction length is 6 bytes to allow them to be replaced with
"lfence; call *%r8-r15" or "lfence; jmp *%r8-r15" at run-time.

gcc/

PR target/102952
* config/i386/i386.c (ix86_output_jmp_thunk_or_indirect): Emit
CS prefix for -mindirect-branch-cs-prefix.
(ix86_output_indirect_branch_via_reg): Likewise.
* config/i386/i386.opt: Add -mindirect-branch-cs-prefix.
* doc/invoke.texi: Document -mindirect-branch-cs-prefix.

gcc/testsuite/

PR target/102952
* gcc.target/i386/indirect-thunk-cs-prefix-1.c: New test.
* gcc.target/i386/indirect-thunk-cs-prefix-2.c: Likewise.
gcc/config/i386/i386.c
gcc/config/i386/i386.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/i386/indirect-thunk-cs-prefix-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/indirect-thunk-cs-prefix-2.c [new file with mode: 0644]
This page took 0.069535 seconds and 6 git commands to generate.