This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to recursively search libs using gcc
On 13 January 2011 10:28, Name lastlong wrote:
> Hi,
>
> We have an option "--start-group <archive or obj files> --end-group"
> to LD that searches the libs recursively.
>
> What do I need to do (if I want to use gcc for linking and not LD) for searching libs recursively using gcc?
>
> I know following workaround;
> #gcc -Wl,--start-group <obj or archive files> -Wl,--end-group
That's not a workaround, it's how to tell gcc to pass arguments to the
linker, so that's the right way to do it.
That's described in the man page for gnu ld.
> Is there any other way?
gcc '-Wl,-(' <obj or archive files> '-Wl,-)'
But it is just the same as using start-group/end-group
> Does gcc, by default, searches libs recursively?
No. You can see the options passed to the linker by using 'gcc -v ...'