2018-23-01 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / config / cet.m4
blob715f4bded19c311ea4159678cfb5862b06a255b7
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, default, ,[enable Intel CET in target libraries],
7            permit yes|no|default)
8 case "$host" in
9   i[[34567]]86-*-linux* | x86_64-*-linux*)
10     case "$enable_cet" in
11       default)
12         # Check if assembler supports CET.
13         AC_COMPILE_IFELSE(
14          [AC_LANG_PROGRAM(
15           [],
16           [asm ("setssbsy");])],
17          [enable_cet=yes],
18          [enable_cet=no])
19         ;;
20       yes)
21         # Check if assembler supports CET.
22         AC_COMPILE_IFELSE(
23          [AC_LANG_PROGRAM(
24           [],
25           [asm ("setssbsy");])],
26          [],
27          [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
28         ;;
29     esac
30     ;;
31   *)
32     enable_cet=no
33     ;;
34 esac
35 if test x$enable_cet = xyes; then
36   $1="-fcf-protection -mcet"