3 dnl (SHELL-CODE_HANDLER)
5 AC_DEFUN([GCC_CET_FLAGS],[dnl
6 GCC_ENABLE(cet, no, ,[enable Intel CET in target libraries],
8 AC_MSG_CHECKING([for CET support])
11 i[[34567]]86-*-linux* | x86_64-*-linux*)
14 # Check if target supports multi-byte NOPs
15 # and if assembler supports CET insn.
20 #if !defined(__SSE2__)
21 #error target does not support multi-byte NOPs
30 # Check if assembler supports CET.
34 [asm ("setssbsy");])],
36 [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
44 if test x$enable_cet = xyes; then
45 $1="-fcf-protection -mshstk"
53 dnl GCC_CET_HOST_FLAGS
54 dnl (SHELL-CODE_HANDLER)
56 AC_DEFUN([GCC_CET_HOST_FLAGS],[dnl
57 GCC_ENABLE(cet, auto, ,[enable Intel CET in host libraries],
59 AC_MSG_CHECKING([for CET support])
62 i[[34567]]86-*-linux* | x86_64-*-linux*)
65 CFLAGS="$CFLAGS -fcf-protection"
68 # Check if target supports multi-byte NOPs
69 # and if assembler supports CET insn.
74 #if !defined(__SSE2__)
75 #error target does not support multi-byte NOPs
84 # Check if assembler supports CET.
88 [asm ("setssbsy");])],
90 [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
101 save_CFLAGS="$CFLAGS"
102 CFLAGS="$CFLAGS -fcf-protection=none"
103 save_LDFLAGS="$LDFLAGS"
104 LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk"
105 if test x$may_have_cet = xyes; then
106 # Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work.
113 if test x$may_have_cet = xyes; then
114 if test x$cross_compiling = xno; then
122 __attribute__ ((noinline, noclone))
123 xxx (void (*f) (void))
129 __attribute__ ((noinline, noclone))
144 if test x$enable_cet = xno -a x$have_cet = xyes; then
145 AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
149 # Enable CET in cross compiler if possible so that it will run on both
150 # CET and non-CET hosts.
153 if test x$enable_cet = xyes; then
159 CFLAGS="$save_CFLAGS"
160 LDFLAGS="$save_LDFLAGS"