This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: wrong bfd recognized
- From: Luca Pizzamiglio <luca dot pizzamiglio at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 10 Feb 2012 14:58:21 +0100
- Subject: Re: wrong bfd recognized
- References: <CAB88xy91dt7mOT4wjkaDCvDmj03LjZ_BAV7xTGsaeWe0ZdDe7Q@mail.gmail.com> <4F318648.8@redhat.com> <4F35219F.401@redhat.com>
Hi Pedro,
sorry for the delay.
You're right. also CFLAG should be updated.
I didn't see it, because it has generated no problem.
Thanks
Best regards,
Luca
On Fri, Feb 10, 2012 at 2:54 PM, Pedro Alves <palves@redhat.com> wrote:
> 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>.