linux-common.h (LINK_MPX): New.
authorIlya Enkovich <enkovich.gnu@gmail.com>
Thu, 16 Jul 2015 08:36:02 +0000 (08:36 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Thu, 16 Jul 2015 08:36:02 +0000 (08:36 +0000)
gcc/

* config/i386/linux-common.h (LINK_MPX): New.
(MPX_SPEC): Use LINK_MPX instead of %(link_mpx).
* configure.ac: Add HAVE_LD_BNDPLT_SUPPORT macro
indicating '-z bndplt' support by linker.
* configure: Regenerate.
* config.in: Regenerate.

libmpx/

* configure.ac: Remove link_mpx.
* libmpx.spec.in: Likewise.
* configure: Regenerate.

From-SVN: r225862

gcc/ChangeLog
gcc/config.in
gcc/config/i386/linux-common.h
gcc/configure
gcc/configure.ac
libmpx/ChangeLog
libmpx/configure
libmpx/configure.ac
libmpx/libmpx.spec.in

index 0287697ecb4f44cfcf1b6ec29016e6b943768c6c..8e2dc6120732692818b91bda9810e66fdc7e66c3 100644 (file)
@@ -1,3 +1,12 @@
+2015-07-16  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * config/i386/linux-common.h (LINK_MPX): New.
+       (MPX_SPEC): Use LINK_MPX instead of %(link_mpx).
+       * configure.ac: Add HAVE_LD_BNDPLT_SUPPORT macro
+       indicating '-z bndplt' support by linker.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+
 2015-07-16  Richard Biener  <rguenther@suse.de>
 
        * fold-const.c (fold_widened_comparison): Remove.
index b031a62e838327232a62e4eac6aa127402ab7dbc..b35b0ee075a6e706d0acc3a85a63cb982ca3784e 100644 (file)
 #endif
 
 
+/* Define if your assembler supports relocs needed by -fpic. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_SMALL_PIC_RELOCS
+#endif
+
+
 /* Define if your assembler supports SPARC4 instructions. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_SPARC4
 #endif
 
 
-/* Define if your assembler supports relocs needed by -fpic. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_SMALL_PIC_RELOCS
-#endif
-
-
 /* Define if your assembler and linker support thread-local storage. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_TLS
 #endif
 
 
+/* Define if your linker supports -z bndplt */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_BNDPLT_SUPPORT
+#endif
+
+
 /* Define if your linker supports --build-id. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_LD_BUILDID
index dd79ec663e9a7b7ccdb7f28ec3302afc1a1afcbb..63dd8d87152a12aac5faa780415d104958b508e0 100644 (file)
@@ -59,9 +59,20 @@ along with GCC; see the file COPYING3.  If not see
  %:include(libmpx.spec)%(link_libmpx)"
 #endif
 
+#ifndef LINK_MPX
+#if defined (HAVE_LD_BNDPLT_SUPPORT)
+#define LINK_MPX "-z bndplt "
+#else
+#define LINK_MPX \
+  "%nGCC was configured with a linker with no '-z bndplt' support. " \
+  "It significantly reduces MPX coverage for dynamic codes. " \
+  "It is strongly recommended to use GCC properly configured for MPX."
+#endif
+#endif
+
 #ifndef MPX_SPEC
 #define MPX_SPEC "\
- %{mmpx:%{fcheck-pointer-bounds:%{!static:%:include(libmpx.spec)%(link_mpx)}}}"
+ %{mmpx:%{fcheck-pointer-bounds:%{!static:" LINK_MPX "}}}"
 #endif
 
 #ifndef LIBMPX_SPEC
index e0755f9ba82c1d1ac145e2cc812e568cf3c62c4a..3d55bdab63e7deee73493a3c1822c6427f4ebd47 100755 (executable)
@@ -28852,6 +28852,30 @@ if test "$gcc_cv_no_pie" = "yes"; then
 fi
 
 
+# Check linker supports '-z bndplt'
+ld_bndplt_support=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker -z bndplt option" >&5
+$as_echo_n "checking linker -z bndplt option... " >&6; }
+if test x"$ld_is_gold" = xno; then
+  if test $in_tree_ld = yes ; then
+    if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
+      ld_bndplt_support=yes
+    fi
+  elif test x$gcc_cv_ld != x; then
+    # Check if linker supports -a bndplt option
+    if $gcc_cv_ld --help 2>/dev/null | grep -- '-z bndplt' > /dev/null; then
+      ld_bndplt_support=yes
+    fi
+  fi
+fi
+if test x"$ld_bndplt_support" = xyes; then
+
+$as_echo "#define HAVE_LD_BNDPLT_SUPPORT 1" >>confdefs.h
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_bndplt_support" >&5
+$as_echo "$ld_bndplt_support" >&6; }
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
index 7af6dbd3bec8025440f7eebee5c9a8759da89b84..583324f87a84439a45a767fec7e5f899f6cd6adb 100644 (file)
@@ -5865,6 +5865,27 @@ if test "$gcc_cv_no_pie" = "yes"; then
 fi
 AC_SUBST([NO_PIE_FLAG])
 
+# Check linker supports '-z bndplt'
+ld_bndplt_support=no
+AC_MSG_CHECKING(linker -z bndplt option)
+if test x"$ld_is_gold" = xno; then
+  if test $in_tree_ld = yes ; then
+    if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then
+      ld_bndplt_support=yes
+    fi
+  elif test x$gcc_cv_ld != x; then
+    # Check if linker supports -a bndplt option
+    if $gcc_cv_ld --help 2>/dev/null | grep -- '-z bndplt' > /dev/null; then
+      ld_bndplt_support=yes
+    fi
+  fi
+fi
+if test x"$ld_bndplt_support" = xyes; then
+  AC_DEFINE(HAVE_LD_BNDPLT_SUPPORT, 1,
+       [Define if your linker supports -z bndplt])
+fi
+AC_MSG_RESULT($ld_bndplt_support)
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
index b6d9f96fe5e3fd3429f9ddfb5e97f79cbd9df447..450b7d36e8c0b4b7264b3441933f99a427c8f2e6 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-16  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * configure.ac: Remove link_mpx.
+       * libmpx.spec.in: Likewise.
+       * configure: Regenerate.
+
 2015-05-13  Michael Haubenwallner  <michael.haubenwallner@ssi-schaefer.com>
 
        * Makefile.in: Regenerated with automake-1.11.6.
index 8e260ed462749b695b5c32af3a0bc814c2c3a66e..16d0dd85d3d705f5d02488015c8c6fe2568066e1 100644 (file)
@@ -666,7 +666,6 @@ am__isrc
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
-link_mpx
 link_libmpx
 LIBMPX_SUPPORTED_FALSE
 LIBMPX_SUPPORTED_TRUE
@@ -2364,25 +2363,6 @@ fi
 
 
 link_libmpx="-lpthread"
-link_mpx=""
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ld accepts -z bndplt" >&5
-$as_echo_n "checking whether ld accepts -z bndplt... " >&6; }
-echo "int main() {};" > conftest.c
-if { ac_try='${CC} ${CFLAGS} -Wl,-z,bndplt -o conftest conftest.c 1>&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-    link_mpx="$link_mpx -z bndplt"
-else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
 
 
 am__api_version='1.11'
@@ -11250,7 +11230,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11253 "configure"
+#line 11233 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11356,7 +11336,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11359 "configure"
+#line 11339 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 463e85562bcb0158dda1b6f0c0acfb8983981236..18ba6872035b13786e67f0de2e625e2335d0efca 100644 (file)
@@ -39,18 +39,7 @@ AC_MSG_RESULT($LIBMPX_SUPPORTED)
 AM_CONDITIONAL(LIBMPX_SUPPORTED, [test "x$LIBMPX_SUPPORTED" = "xyes"])
 
 link_libmpx="-lpthread"
-link_mpx=""
-AC_MSG_CHECKING([whether ld accepts -z bndplt])
-echo "int main() {};" > conftest.c
-if AC_TRY_COMMAND([${CC} ${CFLAGS} -Wl,-z,bndplt -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
-then
-    AC_MSG_RESULT([yes])
-    link_mpx="$link_mpx -z bndplt"
-else
-    AC_MSG_RESULT([no])
-fi
 AC_SUBST(link_libmpx)
-AC_SUBST(link_mpx)
 
 AM_INIT_AUTOMAKE(foreign no-dist no-dependencies)
 AM_ENABLE_MULTILIB(, ..)
index 34d0bdf165a8ac6d16ac730b7c4127312630df06..a80bba71123e7a1134990f3a5e527be5d3533a82 100644 (file)
@@ -1,5 +1,3 @@
 # This spec file is read by gcc when linking.  It is used to specify the
 # standard libraries we need in order to link with libmpx.
 *link_libmpx: @link_libmpx@
-
-*link_mpx: @link_mpx@