[42/46] Add vec_info::replace_stmt
[official-gcc.git] / config / cet.m4
blobb53c1bbd5cdef2d3241c192fe01b0ce02af9edcf
1 dnl
2 dnl GCC_CET_FLAGS
3 dnl    (SHELL-CODE_HANDLER)
4 dnl
5 AC_DEFUN([GCC_CET_FLAGS],[dnl
6 GCC_ENABLE(cet, no, ,[enable Intel CET in target libraries],
7            permit yes|no|auto)
8 AC_MSG_CHECKING([for CET support])
10 case "$host" in
11   i[[34567]]86-*-linux* | x86_64-*-linux*)
12     case "$enable_cet" in
13       auto)
14         # Check if target supports multi-byte NOPs
15         # and if assembler supports CET insn.
16         AC_COMPILE_IFELSE(
17          [AC_LANG_PROGRAM(
18           [],
19           [
20 #if !defined(__SSE2__)
21 #error target does not support multi-byte NOPs
22 #else
23 asm ("setssbsy");
24 #endif
25           ])],
26          [enable_cet=yes],
27          [enable_cet=no])
28         ;;
29       yes)
30         # Check if assembler supports CET.
31         AC_COMPILE_IFELSE(
32          [AC_LANG_PROGRAM(
33           [],
34           [asm ("setssbsy");])],
35          [],
36          [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
37         ;;
38     esac
39     ;;
40   *)
41     enable_cet=no
42     ;;
43 esac
44 if test x$enable_cet = xyes; then
45   $1="-fcf-protection -mshstk"
46   AC_MSG_RESULT([yes])
47 else
48   AC_MSG_RESULT([no])