[Bug target/102952] New code-gen options for retpolines and straight line speculation

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 17 21:35:55 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952

--- Comment #27 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:53a643f8568067d7700a9f2facc8ba39974973d3

commit r12-5353-g53a643f8568067d7700a9f2facc8ba39974973d3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Oct 27 07:48:54 2021 -0700

    x86: Add -mharden-sls=[none|all|return|indirect-branch]

    Add -mharden-sls= to mitigate against straight line speculation (SLS)
    for function return and indirect branch by adding an INT3 instruction
    after function return and indirect branch.

    gcc/

            PR target/102952
            * config/i386/i386-opts.h (harden_sls): New enum.
            * config/i386/i386.c (output_indirect_thunk): Mitigate against
            SLS for function return.
            (ix86_output_function_return): Likewise.
            (ix86_output_jmp_thunk_or_indirect): Mitigate against indirect
            branch.
            (ix86_output_indirect_jmp): Likewise.
            (ix86_output_call_insn): Likewise.
            * config/i386/i386.opt: Add -mharden-sls=.
            * doc/invoke.texi: Document -mharden-sls=.

    gcc/testsuite/

            PR target/102952
            * gcc.target/i386/harden-sls-1.c: New test.
            * gcc.target/i386/harden-sls-2.c: Likewise.
            * gcc.target/i386/harden-sls-3.c: Likewise.
            * gcc.target/i386/harden-sls-4.c: Likewise.
            * gcc.target/i386/harden-sls-5.c: Likewise.


More information about the Gcc-bugs mailing list