From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4887 invoked by alias); 29 Nov 2012 17:40:39 -0000 Received: (qmail 4688 invoked by uid 22791); 29 Nov 2012 17:40:37 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Nov 2012 17:40:33 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 29 Nov 2012 09:40:32 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by azsmga001.ch.intel.com with ESMTP; 29 Nov 2012 09:40:32 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id D9C4C8099E; Thu, 29 Nov 2012 09:40:31 -0800 (PST) Date: Thu, 29 Nov 2012 17:40:00 -0000 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: [PATCH] Filter out -fsanitize=address if not in combined tree in libiberty Message-ID: <20121129174031.GA31369@intel.com> Reply-To: "H.J. Lu" References: <20121129173813.GA31323@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121129173813.GA31323@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 X-SW-Source: 2012-11/txt/msg02468.txt.bz2 Hi, When GCC is configured with --with-build-config="bootstrap-asan", all -flto tests will fail since -fsanitize=address is used to compile host libiberty, which is used to create liblto_plugin.so, and linker isn't compiled with -fsanitize=address. This patch filters out -fsanitize=address from CFLAGS if we aren't in a combined tree with binutils. OK to install? Thanks. H.J. --- 2012-11-21 H.J. Lu * Makefile.in (CFLAGS): Filter out -fsanitize=address if in GCC tree, but not in a combined tree with binutils. * configure.ac (COMBINED_TREE_FALSE): New AC_SUBST. * configure: Regenerated. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 1ba8cf1..2d357d7 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -63,6 +63,10 @@ PERL = @PERL@ PICFLAG = @PICFLAG@ +# Filter out -fsanitize=address if we are in GCC tree, but aren't in a +# combined tree with binutils. +@COMBINED_TREE_FALSE@override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS)) + MAKEOVERRIDES = TARGETLIB = ./libiberty.a diff --git a/libiberty/configure b/libiberty/configure index 5367027..4869cd5 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -590,6 +590,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS INSTALL_DEST +COMBINED_TREE_FALSE pexecute target_header_dir CHECK @@ -6917,6 +6918,20 @@ esac fi +# Check if this is in GCC tree, but aren't in a combined tree with +# binutils. +if test -e ${srcdir}/../gcc/gcc.c; then + if test -e ${srcdir}/../ld/ldmain.c -o \ + -e ${top_srcdir}/../gold/version.cc; then + COMBINED_TREE_FALSE='#' + else + COMBINED_TREE_FALSE='' + fi +else + COMBINED_TREE_FALSE='#' +fi + + # Install a library built with a cross compiler in $(tooldir) rather # than $(libdir). if test -z "${with_cross_host}"; then diff --git a/libiberty/configure.ac b/libiberty/configure.ac index c763894..7661752 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -670,6 +670,20 @@ AC_SUBST(pexecute) libiberty_AC_FUNC_STRNCMP +# Check if this is in GCC tree, but aren't in a combined tree with +# binutils. +if test -e ${srcdir}/../gcc/gcc.c; then + if test -e ${srcdir}/../ld/ldmain.c -o \ + -e ${top_srcdir}/../gold/version.cc; then + COMBINED_TREE_FALSE='#' + else + COMBINED_TREE_FALSE='' + fi +else + COMBINED_TREE_FALSE='#' +fi +AC_SUBST(COMBINED_TREE_FALSE) + # Install a library built with a cross compiler in $(tooldir) rather # than $(libdir). if test -z "${with_cross_host}"; then -- 1.7.11.7