aboutsummaryrefslogtreecommitdiff
path: root/libcpp/configure
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/configure')
-rwxr-xr-xlibcpp/configure43
1 files changed, 37 insertions, 6 deletions
diff --git a/libcpp/configure b/libcpp/configure
index 64bbf54..7f02d6b 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -7525,10 +7525,35 @@ 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
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk"
- if test "$cross_compiling" = yes; 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
+ if test x$cross_compiling = xno; then
+ 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;}
as_fn_error $? "cannot run test program while cross compiling
@@ -7573,10 +7598,14 @@ 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
+ 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
fi
+else
+ # Enable CET in cross compiler if possible so that it will run on both
+ # CET and non-CET hosts.
+ have_cet=yes
fi
if test x$enable_cet = xyes; then
CET_HOST_FLAGS="-fcf-protection"
@@ -7586,6 +7615,8 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+CFLAGS="$save_CFLAGS"
+LDFLAGS="$save_LDFLAGS"
case x$enable_languages in
*jit*)