Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luca Pizzamiglio <luca.pizzamiglio@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: wrong bfd recognized
Date: Fri, 10 Feb 2012 13:55:00 -0000	[thread overview]
Message-ID: <4F35219F.401@redhat.com> (raw)
In-Reply-To: <4F318648.8@redhat.com>

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  <palves@redhat.com>

	* 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) <PLUGINS>.
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) <PLUGINS>.


  reply	other threads:[~2012-02-10 13:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 15:29 Luca Pizzamiglio
2011-12-20 14:58 ` Tom Tromey
2011-12-21 12:24   ` Luca Pizzamiglio
2011-12-21 18:50     ` Tom Tromey
2011-12-29 12:18       ` Luca Pizzamiglio
2011-12-29 19:02         ` Joel Brobecker
2012-01-02 10:04           ` Luca Pizzamiglio
2012-02-06 19:33             ` Tom Tromey
2012-02-07 16:25               ` Luca Pizzamiglio
2012-02-07 20:15 ` Pedro Alves
2012-02-10 13:55   ` Pedro Alves [this message]
2012-02-10 13:59     ` Luca Pizzamiglio
2012-02-10 14:02       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F35219F.401@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luca.pizzamiglio@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox