Joseph Garvin <joseph.h.garvin@xxxxxxxxx> 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