Re: wrong bfd recognized

Pedro Alves
2012-02-07T20:15:32Z

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"

--
Pedro Alves