diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0287697ecb4..8e2dc612073 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-07-16 Ilya Enkovich + + * 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 * fold-const.c (fold_widened_comparison): Remove. diff --git a/gcc/config.in b/gcc/config.in index b031a62e838..b35b0ee075a 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -574,6 +574,12 @@ #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 @@ -606,12 +612,6 @@ #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 @@ -1369,6 +1369,12 @@ #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 diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h index dd79ec663e9..63dd8d87152 100644 --- a/gcc/config/i386/linux-common.h +++ b/gcc/config/i386/linux-common.h @@ -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 diff --git a/gcc/configure b/gcc/configure index e0755f9ba82..3d55bdab63e 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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) diff --git a/gcc/configure.ac b/gcc/configure.ac index 7af6dbd3bec..583324f87a8 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -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) diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog index b6d9f96fe5e..450b7d36e8c 100644 --- a/libmpx/ChangeLog +++ b/libmpx/ChangeLog @@ -1,3 +1,9 @@ +2015-07-16 Ilya Enkovich + + * configure.ac: Remove link_mpx. + * libmpx.spec.in: Likewise. + * configure: Regenerate. + 2015-05-13 Michael Haubenwallner * Makefile.in: Regenerated with automake-1.11.6. diff --git a/libmpx/configure b/libmpx/configure index 8e260ed4627..16d0dd85d3d 100644 --- a/libmpx/configure +++ b/libmpx/configure @@ -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 diff --git a/libmpx/configure.ac b/libmpx/configure.ac index 463e85562bc..18ba6872035 100644 --- a/libmpx/configure.ac +++ b/libmpx/configure.ac @@ -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(, ..) diff --git a/libmpx/libmpx.spec.in b/libmpx/libmpx.spec.in index 34d0bdf165a..a80bba71123 100644 --- a/libmpx/libmpx.spec.in +++ b/libmpx/libmpx.spec.in @@ -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@