aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-04-29 14:25:36 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-04-29 14:25:36 -0700
commit87c66b2e70e421983a826518ff5e03d17eaa8f4c (patch)
tree404effb0becdaa86f5a132dddf48d70815f6d1de /config
parent42e165c30c2f0602a73d301bd62a49a2290360c4 (diff)
downloadbinutils-87c66b2e70e421983a826518ff5e03d17eaa8f4c.zip
binutils-87c66b2e70e421983a826518ff5e03d17eaa8f4c.tar.gz
binutils-87c66b2e70e421983a826518ff5e03d17eaa8f4c.tar.bz2
Sync config and libiberty with GCC
config/ 2020-04-29 H.J. Lu <hongjiu.lu@intel.com> Sync with GCC 2020-04-28 H.J. Lu <hongjiu.lu@intel.com> 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. 2020-04-25 H.J. Lu <hongjiu.lu@intel.com> PR bootstrap/94739 * cet.m4 (GCC_CET_HOST_FLAGS): New. 2020-04-22 Jakub Jelinek <jakub@redhat.com> PR libfortran/94694 PR libfortran/94586 * math.m4 (GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1, GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2): New. libiberty/ 2020-04-28 H.J. Lu <hongjiu.lu@intel.com> PR bootstrap/94739 * configure: Regenerated.
Diffstat (limited to 'config')
-rw-r--r--config/ChangeLog22
-rw-r--r--config/cet.m4105
-rw-r--r--config/math.m464
3 files changed, 191 insertions, 0 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index 959695d..ece21f2 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,25 @@
+2020-04-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ Sync with GCC
+ 2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ 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.
+
+ 2020-04-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/94739
+ * cet.m4 (GCC_CET_HOST_FLAGS): New.
+
+ 2020-04-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR libfortran/94694
+ PR libfortran/94586
+ * math.m4 (GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1,
+ GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2): New.
+
2020-02-19 Andrew Burgess <andrew.burgess@embecosm.com>
* ax_count_cpus.m4: New file, backported from GCC.
diff --git a/config/cet.m4 b/config/cet.m4
index b53c1bb..ea616b7 100644
--- a/config/cet.m4
+++ b/config/cet.m4
@@ -48,3 +48,108 @@ else
AC_MSG_RESULT([no])
fi
])
+
+dnl
+dnl GCC_CET_HOST_FLAGS
+dnl (SHELL-CODE_HANDLER)
+dnl
+AC_DEFUN([GCC_CET_HOST_FLAGS],[dnl
+GCC_ENABLE(cet, auto, ,[enable Intel CET in host libraries],
+ permit yes|no|auto)
+AC_MSG_CHECKING([for CET support])
+
+case "$host" in
+ i[[34567]]86-*-linux* | x86_64-*-linux*)
+ may_have_cet=yes
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fcf-protection"
+ case "$enable_cet" in
+ auto)
+ # Check if target supports multi-byte NOPs
+ # and if assembler supports CET insn.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [],
+ [
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
+asm ("setssbsy");
+#endif
+ ])],
+ [enable_cet=yes],
+ [enable_cet=no])
+ ;;
+ yes)
+ # Check if assembler supports CET.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [],
+ [asm ("setssbsy");])],
+ [],
+ [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
+ ;;
+ esac
+ CFLAGS="$save_CFLAGS"
+ ;;
+ *)
+ may_have_cet=no
+ enable_cet=no
+ ;;
+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.
+ AC_TRY_LINK(
+ [],[return 0;],
+ [may_have_cet=yes],
+ [may_have_cet=no])
+fi
+
+if test x$may_have_cet = xyes; then
+ AC_TRY_RUN([
+static void
+foo (void)
+{
+}
+
+static void
+__attribute__ ((noinline, noclone))
+xxx (void (*f) (void))
+{
+ f ();
+}
+
+static void
+__attribute__ ((noinline, noclone))
+bar (void)
+{
+ xxx (foo);
+}
+
+int
+main ()
+{
+ bar ();
+ return 0;
+}
+ ],
+ [have_cet=no],
+ [have_cet=yes])
+ if test x$enable_cet = xno -a x$have_cet = xyes; then
+ AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
+ fi
+fi
+if test x$enable_cet = xyes; then
+ $1="-fcf-protection"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+CFLAGS="$save_CFLAGS"
+LDFLAGS="$save_LDFLAGS"
+])
diff --git a/config/math.m4 b/config/math.m4
index 155967e..e1e88d0 100644
--- a/config/math.m4
+++ b/config/math.m4
@@ -48,3 +48,67 @@ main ()
[Define to 1 if you have the `$1' function.])
fi
])
+
+dnl GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1([name], [type])
+dnl
+dnl Check if math function NAME fallback for function with single
+dnl TYPE argument and TYPE result can be implemented using
+dnl __builtin_NAME expanded inline without needing unavailable math
+dnl library function.
+AC_DEFUN([GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1],
+[
+ AC_REQUIRE([GCC_CHECK_LIBM])
+if test $gcc_cv_math_func_$1 = no; then
+ AC_CACHE_CHECK([for inline __builtin_$1], [gcc_cv_math_inline_builtin_$1],
+ [AC_LINK_IFELSE([AC_LANG_SOURCE([
+$2
+$1_fallback ($2 x)
+{
+ return __builtin_$1 (x);
+}
+
+int
+main ()
+{
+ return 0;
+}
+])],
+[gcc_cv_math_inline_builtin_$1=yes],
+[gcc_cv_math_inline_builtin_$1=no])])
+ if test $gcc_cv_math_inline_builtin_$1 = yes; then
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_INLINE_BUILTIN_$1),[1],
+ [Define to 1 if `__builtin_$1' is expanded inline.])
+ fi
+fi])
+
+dnl GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2([name], [type])
+dnl
+dnl Check if math function NAME fallback for function with two
+dnl TYPE arguments and TYPE result can be implemented using
+dnl __builtin_NAME expanded inline without needing unavailable math
+dnl library function.
+AC_DEFUN([GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2],
+[
+ AC_REQUIRE([GCC_CHECK_LIBM])
+if test $gcc_cv_math_func_$1 = no; then
+ AC_CACHE_CHECK([for inline __builtin_$1], [gcc_cv_math_inline_builtin_$1],
+ [AC_LINK_IFELSE([AC_LANG_SOURCE([
+$2
+$1_fallback ($2 x, $2 y)
+{
+ return __builtin_$1 (x, y);
+}
+
+int
+main ()
+{
+ return 0;
+}
+])],
+[gcc_cv_math_inline_builtin_$1=yes],
+[gcc_cv_math_inline_builtin_$1=no])])
+ if test $gcc_cv_math_inline_builtin_$1 = yes; then
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_INLINE_BUILTIN_$1),[1],
+ [Define to 1 if `__builtin_$1' is expanded inline.])
+ fi
+fi])