diff options
author | Ilya Enkovich <enkovich.gnu@gmail.com> | 2015-07-16 08:36:02 +0000 |
---|---|---|
committer | Ilya Enkovich <ienkovich@gcc.gnu.org> | 2015-07-16 08:36:02 +0000 |
commit | 6de59c8aaa0b850738ae6f5413ef81a1720a1f06 (patch) | |
tree | 7706ecb501d46fdbf8b14b786c1abd6648f91c52 /gcc | |
parent | 79d4f7c66e9c8462aee46a3488f589969851bd80 (diff) | |
download | gcc-6de59c8aaa0b850738ae6f5413ef81a1720a1f06.zip gcc-6de59c8aaa0b850738ae6f5413ef81a1720a1f06.tar.gz gcc-6de59c8aaa0b850738ae6f5413ef81a1720a1f06.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config.in | 18 | ||||
-rw-r--r-- | gcc/config/i386/linux-common.h | 13 | ||||
-rwxr-xr-x | gcc/configure | 24 | ||||
-rw-r--r-- | gcc/configure.ac | 21 |
5 files changed, 78 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0287697..8e2dc61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/config.in b/gcc/config.in index b031a62..b35b0ee 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 dd79ec6..63dd8d8 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 e0755f9..3d55bda 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 7af6dbd..583324f 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) |