From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81528 invoked by alias); 18 Mar 2015 11:56:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 81510 invoked by uid 89); 18 Mar 2015 11:56:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ie0-f180.google.com Received: from mail-ie0-f180.google.com (HELO mail-ie0-f180.google.com) (209.85.223.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 18 Mar 2015 11:56:46 +0000 Received: by iegc3 with SMTP id c3so36123391ieg.3 for ; Wed, 18 Mar 2015 04:56:44 -0700 (PDT) X-Received: by 10.107.156.19 with SMTP id f19mr6471501ioe.45.1426679804352; Wed, 18 Mar 2015 04:56:44 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.54.40]) by mx.google.com with ESMTPSA id g9sm1542375igg.1.2015.03.18.04.56.42 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 04:56:43 -0700 (PDT) Date: Wed, 18 Mar 2015 11:56:00 -0000 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Cc: ubizjak@gmail.com Subject: [PATCH, libmpx, i386, PR driver/65444] Pass '-z bndplt' when building dynamic objects with MPX Message-ID: <20150318115630.GA64546@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00917.txt.bz2 Hi, This patch fixes PR target/65444 by passing '-z bndplt' to linker when appropriate. Bootstrapped and tested on x86_64-unknown-linux-gnu. Will commit it to trunk in a couple of days if no objections arise. Thanks, Ilya -- gcc/ 2015-03-18 Ilya Enkovich PR driver/65444 * config/i386/linux-common.h (MPX_SPEC): New. (CHKP_SPEC): Add MPX_SPEC. libmpx/ 2015-03-18 Ilya Enkovich PR driver/65444 * configure.ac: Add check for '-z bndplt' support by linker. Add link_mpx output variable. * libmpx.spec.in (link_mpx): New. * configure: Regenerate. diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h index 9c6560b..dd79ec6 100644 --- a/gcc/config/i386/linux-common.h +++ b/gcc/config/i386/linux-common.h @@ -59,6 +59,11 @@ along with GCC; see the file COPYING3. If not see %:include(libmpx.spec)%(link_libmpx)" #endif +#ifndef MPX_SPEC +#define MPX_SPEC "\ + %{mmpx:%{fcheck-pointer-bounds:%{!static:%:include(libmpx.spec)%(link_mpx)}}}" +#endif + #ifndef LIBMPX_SPEC #if defined(HAVE_LD_STATIC_DYNAMIC) #define LIBMPX_SPEC "\ @@ -89,5 +94,5 @@ along with GCC; see the file COPYING3. If not see #ifndef CHKP_SPEC #define CHKP_SPEC "\ -%{!nostdlib:%{!nodefaultlibs:" LIBMPX_SPEC LIBMPXWRAPPERS_SPEC "}}" +%{!nostdlib:%{!nodefaultlibs:" LIBMPX_SPEC LIBMPXWRAPPERS_SPEC "}}" MPX_SPEC #endif diff --git a/libmpx/configure.ac b/libmpx/configure.ac index fe0d3f2..3f8b50f 100644 --- a/libmpx/configure.ac +++ b/libmpx/configure.ac @@ -40,7 +40,18 @@ 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 a265e28..34d0bdf 100644 --- a/libmpx/libmpx.spec.in +++ b/libmpx/libmpx.spec.in @@ -1,3 +1,5 @@ # This spec file is read by gcc when linking. It is used to specify the -# standard libraries we need in order to link with libcilkrts. +# standard libraries we need in order to link with libmpx. *link_libmpx: @link_libmpx@ + +*link_mpx: @link_mpx@