From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26641 invoked by alias); 10 Feb 2012 13:55:00 -0000 Received: (qmail 26628 invoked by uid 22791); 10 Feb 2012 13:54:59 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Feb 2012 13:54:41 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1ADsedh016027 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Feb 2012 08:54:40 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1ADsd5L011677; Fri, 10 Feb 2012 08:54:39 -0500 Message-ID: <4F35219F.401@redhat.com> Date: Fri, 10 Feb 2012 13:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Luca Pizzamiglio CC: gdb-patches@sourceware.org Subject: Re: wrong bfd recognized References: <4F318648.8@redhat.com> In-Reply-To: <4F318648.8@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00188.txt.bz2 On 02/07/2012 08:15 PM, Pedro Alves wrote: > On 12/13/2011 03:13 PM, Luca Pizzamiglio wrote: >> +++ gdb/configure.ac 2011-12-13 15:34:08.559285673 +0100 >> @@ -1854,7 +1854,7 @@ >> OLD_LDFLAGS=$LDFLAGS >> OLD_LIBS=$LIBS >> CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd" >> -LDFLAGS="$LDFLAGS -L../bfd -L../libiberty" >> +LDFLAGS="-L../bfd -L../libiberty $LDFLAGS" > > If you set LDFLAGS to -L/foo/lib , you presumably also set > CFLAGS to -I/foo/include . In that case, after the patch, if there's a libbfd > in /foo/, you'll run the test with gdb's bfd, but compile it against e.g., the > bfd.h from /foo/include. You may not see this happen with /usr/local/include > because gcc usually ignores -I/usr/local/include as being a duplicate of a > system header path. > > IOW, it'd make sense to also do: > > - CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd" > + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" > I'm applying this. 2012-02-10 Pedro Alves * configure.ac (HAVE_ELF test): Put the old CFLAGS at the end of the test CFLAGS. * configure: Regenerate. --- gdb/configure | 5 ++++- gdb/configure.ac | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gdb/configure b/gdb/configure index 11c044c..2566410 100755 --- a/gdb/configure +++ b/gdb/configure @@ -15320,7 +15320,10 @@ esac OLD_CFLAGS=$CFLAGS OLD_LDFLAGS=$LDFLAGS OLD_LIBS=$LIBS -CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd" +# Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS +# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We +# always want our bfd. +CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" LDFLAGS="-L../bfd -L../libiberty $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` # -ldl is provided by bfd/Makfile.am (LIBDL) . diff --git a/gdb/configure.ac b/gdb/configure.ac index 36da463..1b11adb 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1908,7 +1908,10 @@ AC_SUBST(WIN32LIBS) OLD_CFLAGS=$CFLAGS OLD_LDFLAGS=$LDFLAGS OLD_LIBS=$LIBS -CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd" +# Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS +# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We +# always want our bfd. +CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" LDFLAGS="-L../bfd -L../libiberty $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` # -ldl is provided by bfd/Makfile.am (LIBDL) .