3 dnl (SHELL-CODE_HANDLER)
5 AC_DEFUN([GCC_CET_FLAGS],[dnl
6 GCC_ENABLE(cet, auto, ,[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.
17 CFLAGS="$CFLAGS -fcf-protection"
22 #if !defined(__SSE2__)
23 #error target does not support multi-byte NOPs
33 # Check if assembler supports CET.
37 [asm ("setssbsy");])],
39 [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
47 if test x$enable_cet = xyes; then
48 $1="-fcf-protection -mshstk"
56 dnl GCC_CET_HOST_FLAGS
57 dnl (SHELL-CODE_HANDLER)
59 AC_DEFUN([GCC_CET_HOST_FLAGS],[dnl
60 GCC_ENABLE(cet, auto, ,[enable Intel CET in host libraries],
62 AC_MSG_CHECKING([for CET support])
65 i[[34567]]86-*-linux* | x86_64-*-linux*)
68 CFLAGS="$CFLAGS -fcf-protection"
71 # Check if target supports multi-byte NOPs
72 # and if assembler supports CET insn.
77 #if !defined(__SSE2__)
78 #error target does not support multi-byte NOPs
87 # Check if assembler supports CET.
91 [asm ("setssbsy");])],
93 [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
104 save_CFLAGS="$CFLAGS"
105 CFLAGS="$CFLAGS -fcf-protection=none"
106 save_LDFLAGS="$LDFLAGS"
107 LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk"
108 if test x$may_have_cet = xyes; then
109 # Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work.
116 if test x$may_have_cet = xyes; then
117 if test x$cross_compiling = xno; then
125 __attribute__ ((noinline, noclone))
126 xxx (void (*f) (void))
132 __attribute__ ((noinline, noclone))
147 if test x$enable_cet = xno -a x$have_cet = xyes; then
148 AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
152 # Enable CET in cross compiler if possible so that it will run on both
153 # CET and non-CET hosts.
156 if test x$enable_cet = xyes; then
162 CFLAGS="$save_CFLAGS"
163 LDFLAGS="$save_LDFLAGS"