summaryrefslogtreecommitdiff
path: root/lto-plugin
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-04-28 05:42:34 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-04-28 05:42:50 -0700
commiteedc73a224df61694fe4802ddec8eb9ad1822f32 (patch)
treeec0322655b95f987b4cc5557775e4400d6a8a6dc /lto-plugin
parent34f6b14ff33e0c64b3a4a1a2cd871df715d69151 (diff)
downloadgcc-eedc73a224df61694fe4802ddec8eb9ad1822f32.tar.gz
Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work first
GCC_CET_HOST_FLAGS uses -Wl,-z,ibt,-z,shstk to check if Linux/x86 host has Intel CET enabled by introducing an Intel CET violation on purpose. To avoid false positive, check whether -Wl,-z,ibt,-z,shstk works first. -fcf-protection=none is added to avoid false negative when -fcf-protection is enabled by default. config/ PR bootstrap/94739 * cet.m4 (GCC_CET_HOST_FLAGS): Add -fcf-protection=none to -Wl,-z,ibt,-z,shstk. Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk works first. libiberty/ PR bootstrap/94739 * configure: Regenerated. lto-plugin/ PR bootstrap/94739 * configure: Regenerated.
Diffstat (limited to 'lto-plugin')
-rw-r--r--lto-plugin/ChangeLog5
-rwxr-xr-xlto-plugin/configure35
2 files changed, 35 insertions, 5 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index d5f7ef0329c..4ffbf122ebd 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/94739
+ * configure: Regenerated.
+
2020-04-25 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/94739
diff --git a/lto-plugin/configure b/lto-plugin/configure
index e55b35ecf38..1baf6cc70b8 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -5741,9 +5741,33 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fcf-protection=none"
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk"
+if test x$may_have_cet = xyes; then
+ # Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ may_have_cet=yes
+else
+ may_have_cet=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
if test x$may_have_cet = xyes; then
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -5789,7 +5813,6 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
- LDFLAGS="$save_LDFLAGS"
if test x$enable_cet = xno -a x$have_cet = xyes; then
as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5
fi
@@ -5802,6 +5825,8 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+CFLAGS="$save_CFLAGS"
+LDFLAGS="$save_LDFLAGS"
@@ -11916,7 +11941,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11919 "configure"
+#line 11944 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12022,7 +12047,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12025 "configure"
+#line 12050 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H