linux-common.h (LINK_MPX): New.

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
This commit is contained in:
Ilya Enkovich 2015-07-16 08:36:02 +00:00 committed by Ilya Enkovich
parent 79d4f7c66e
commit 6de59c8aaa
9 changed files with 86 additions and 42 deletions

View 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.

View File

@ -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

View 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

24
gcc/configure vendored
View File

@ -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)

View 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)

View 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.

24
libmpx/configure vendored
View 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

View 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(, ..)

View 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@