This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Confusing behaviour from gcc and ld with --as-needed
- From: Daniel Jacobowitz <drow at false dot org>
- To: Mike Hearn <mike at navi dot cx>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 4 Apr 2005 14:24:09 -0400
- Subject: Re: Confusing behaviour from gcc and ld with --as-needed
- References: <pan.2005.04.04.18.29.00.196561@navi.cx>
On Mon, Apr 04, 2005 at 07:29:01PM +0100, Mike Hearn wrote:
> Hi,
>
> [mike@littlegreen libexec]$ gcc -o vfolder-magic vfolder-magic.c -Wl,--as-needed `xml-config --cflags --libs`
> [mike@littlegreen libexec]$ needed vfolder-magic
> NEEDED libxml.so.1
> NEEDED libc.so.6
> [mike@littlegreen libexec]$ gcc -o vfolder-magic -Wl,--as-needed `xml-config --cflags --libs` vfolder-magic.c
> [mike@littlegreen libexec]$ needed vfolder-magic
> NEEDED libc.so.6
>
>
> The only difference between the two GCC invocations is the position
> of the source file on the command line. Yet, the output is different.
>
> I'm sure there is some good reason for this, but I can't see what it
> might be. Is there some behaviour of GCC or GNU ld that I have
> overlooked here?
Try adding -v to those command lines to see what's going on?
--
Daniel Jacobowitz
CodeSourcery, LLC