This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Is it possible/desirable to avoid using collect2 on Solaris?
- From: Ian Lance Taylor <iant at google dot com>
- To: Joseph Garvin <joseph dot h dot garvin at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 01 Mar 2010 13:18:54 -0800
- Subject: Re: Is it possible/desirable to avoid using collect2 on Solaris?
- References: <fea8ac9f1002281215j53a70c32gc82457cc17660069@mail.gmail.com>
Joseph Garvin <joseph.h.garvin@gmail.com> writes:
> Based on the documentation here:
>
> http://gcc.gnu.org/onlinedocs/gccint/Collect2.html
>
> It appears that collect2 is inefficient in that it involves two
> passes. I've heard that the GNU linker doesn't require a second pass,
> so if you're using it collect2 should be unnecessary. I'm compiling on
> Solaris, and I know how to get GCC to invoke the GNU linker instead of
> the native Sun one (using -B to point it to a different folder) but if
> I do this and compile a file with -V I can see that it's still running
> collect2. Is there a way to suppress this or is my information
> outdated? If it is possible to avoid using collect2, do any special
> steps need to be taken when not using it or will things 'just work'?
> Google isn't being a lot of help.
Collect2 only uses a second pass if one is required. When using GNU
ld a second pass is normally not required; it will only be needed in
some cases if you use -frepo. So the inefficiency here is relatively
minor, basically just starting the collect2 program and having it do a
bit of argument processing and then start ld. The collect2 program
will also run ld's stdout and stderr through the C++ demangler, but as
ld normally has no output this is cheap.
Ian