Commit ccdf009d by Igor Tsimbalist Committed by Igor Tsimbalist

Add x86 CET documentation.

gcc/doc/
	* extend.texi: Add x86 specific to 'nocf_check' attribute.
	List CET intrinsics.
	* invoke.texi: Add -mcet, -mibt, -mshstk options.  Add x86
	specific to -fcf-protection option.

From-SVN: r253978
parent 2a25448c
2017-10-21 Igor Tsimbalist <igor.v.tsimbalist@intel.com> 2017-10-21 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
* extend.texi: Add x86 specific to 'nocf_check' attribute.
List CET intrinsics.
* invoke.texi: Add -mcet, -mibt, -mshstk options. Add x86
specific to -fcf-protection option.
2017-10-21 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
* common/config/i386/i386-common.c (OPTION_MASK_ISA_IBT_SET): New. * common/config/i386/i386-common.c (OPTION_MASK_ISA_IBT_SET): New.
(OPTION_MASK_ISA_SHSTK_SET): Likewise. (OPTION_MASK_ISA_SHSTK_SET): Likewise.
(OPTION_MASK_ISA_IBT_UNSET): Likewise. (OPTION_MASK_ISA_IBT_UNSET): Likewise.
...@@ -21519,6 +21519,25 @@ void __builtin_ia32_wrpkru (unsigned int) ...@@ -21519,6 +21519,25 @@ void __builtin_ia32_wrpkru (unsigned int)
unsigned int __builtin_ia32_rdpkru () unsigned int __builtin_ia32_rdpkru ()
@end smallexample @end smallexample
The following built-in functions are available when @option{-mcet} is used.
They are used to support Intel Control-flow Enforcment Technology (CET).
Each built-in function generates the machine instruction that is part of the
function's name.
@smallexample
unsigned int __builtin_ia32_rdsspd (unsigned int)
unsigned long long __builtin_ia32_rdsspq (unsigned long long)
void __builtin_ia32_incsspd (unsigned int)
void __builtin_ia32_incsspq (unsigned long long)
void __builtin_ia32_saveprevssp(void);
void __builtin_ia32_rstorssp(void *);
void __builtin_ia32_wrssd(unsigned int, void *);
void __builtin_ia32_wrssq(unsigned long long, void *);
void __builtin_ia32_wrussd(unsigned int, void *);
void __builtin_ia32_wrussq(unsigned long long, void *);
void __builtin_ia32_setssbsy(void);
void __builtin_ia32_clrssbsy(void *);
@end smallexample
@node x86 transactional memory intrinsics @node x86 transactional memory intrinsics
@subsection x86 Transactional Memory Intrinsics @subsection x86 Transactional Memory Intrinsics
......
...@@ -1204,6 +1204,7 @@ See RS/6000 and PowerPC Options. ...@@ -1204,6 +1204,7 @@ See RS/6000 and PowerPC Options.
-msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
-mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
-mmwaitx -mclzero -mpku -mthreads @gol -mmwaitx -mclzero -mpku -mthreads @gol
-mcet -mibt -mshstk @gol
-mms-bitfields -mno-align-stringops -minline-all-stringops @gol -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
...@@ -11441,6 +11442,11 @@ You can also use the @code{nocf_check} attribute to identify ...@@ -11441,6 +11442,11 @@ You can also use the @code{nocf_check} attribute to identify
which functions and calls should be skipped from instrumentation which functions and calls should be skipped from instrumentation
(@pxref{Function Attributes}). (@pxref{Function Attributes}).
Currently the x86 GNU/Linux target provides an implementation based
on Intel Control-flow Enforcement Technology (CET). Instrumentation
for x86 is controlled by target-specific options @option{-mcet},
@option{-mibt} and @option{-mshstk} (@pxref{x86 Options}).
@item -fstack-protector @item -fstack-protector
@opindex fstack-protector @opindex fstack-protector
Emit extra code to check for buffer overflows, such as stack smashing Emit extra code to check for buffer overflows, such as stack smashing
...@@ -25852,15 +25858,19 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}. ...@@ -25852,15 +25858,19 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@need 200 @need 200
@itemx -mclzero @itemx -mclzero
@opindex mclzero @opindex mclzero
@need 200
@itemx -mpku @itemx -mpku
@opindex mpku @opindex mpku
@need 200
@itemx -mcet
@opindex mcet
These switches enable the use of instructions in the MMX, SSE, These switches enable the use of instructions in the MMX, SSE,
SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD, SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, 3DNow!@: or enhanced 3DNow!@: XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, IBT, SHSTK,
extended instruction sets. Each has a corresponding @option{-mno-} option 3DNow!@: or enhanced 3DNow!@: extended instruction sets. Each has a
to disable use of these instructions. corresponding @option{-mno-} option to disable use of these instructions.
These extensions are also available as built-in functions: see These extensions are also available as built-in functions: see
@ref{x86 Built-in Functions}, for details of the functions enabled and @ref{x86 Built-in Functions}, for details of the functions enabled and
...@@ -25880,6 +25890,13 @@ supported architecture, using the appropriate flags. In particular, ...@@ -25880,6 +25890,13 @@ supported architecture, using the appropriate flags. In particular,
the file containing the CPU detection code should be compiled without the file containing the CPU detection code should be compiled without
these options. these options.
The @option{-mcet} option turns on the @option{-mibt} and @option{-mshstk}
options. The @option{-mibt} option enables indirect branch tracking support
and the @option{-mshstk} option enables shadow stack support from
Intel Control-flow Enforcement Technology (CET). The compiler also provides
a number of built-in functions for fine-grained control in a CET-based
application. See @xref{x86 Built-in Functions}, for more information.
@item -mdump-tune-features @item -mdump-tune-features
@opindex mdump-tune-features @opindex mdump-tune-features
This option instructs GCC to dump the names of the x86 performance This option instructs GCC to dump the names of the x86 performance
...@@ -25958,6 +25975,24 @@ see @ref{Other Builtins} for details. ...@@ -25958,6 +25975,24 @@ see @ref{Other Builtins} for details.
This option enables use of the @code{movbe} instruction to implement This option enables use of the @code{movbe} instruction to implement
@code{__builtin_bswap32} and @code{__builtin_bswap64}. @code{__builtin_bswap32} and @code{__builtin_bswap64}.
@item -mibt
@opindex mibt
This option tells the compiler to use indirect branch tracking support
(for indirect calls and jumps) from x86 Control-flow Enforcement
Technology (CET). The option has effect only if the
@option{-fcf-protection=full} or @option{-fcf-protection=branch} option
is specified. The option @option{-mibt} is on by default when the
@code{-mcet} option is specified.
@item -mshstk
@opindex mshstk
This option tells the compiler to use shadow stack support (return
address tracking) from x86 Control-flow Enforcement Technology (CET).
The option has effect only if the @option{-fcf-protection=full} or
@option{-fcf-protection=return} option is specified. The option
@option{-mshstk} is on by default when the @option{-mcet} option is
specified.
@item -mcrc32 @item -mcrc32
@opindex mcrc32 @opindex mcrc32
This option enables built-in functions @code{__builtin_ia32_crc32qi}, This option enables built-in functions @code{__builtin_ia32_crc32qi},
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment