Where to find more information about GNU linker?

Daniel Berlin dan@cgsoftware.com
Thu Apr 12 22:27:00 GMT 2001


Craig Rodrigues <rodrigc@mediaone.net> writes:

> Hi,
> 
> I'd like to learn more about the GNU linker which is
> invoked by gcc on Linux systems.  Can someone recommend
> a good reference?

The manual?
The source?
Dunno past that.

> 
> I am interested in:
> - when linking in a static library (libMylib.a), does the
>   linker only bring into the final executable the
>   symbols that are required, or does it combine all the symbols
>   in the library into the final executable?

Only that which is required, of course.

> 
> - how does the GNU/Linux linker deal with multiple C++ template
>   instantiations?
.gnu.linkonce sections.
template instantiations each get output into a seperate section, with
the name of the section prefixed with .gnu.linkonce.xx (where xx
depends on the type of symbol, and what section it's supposed to end
up in), and the rest being the mangled name.

The linker makes sure only one copy of the stuff in these sections
gets placed into the final executable, in the right section.  The
mangled name takes care of making sure we merge all template
instantiations that are really the same.


> 
> - how does the GNU/Linux linker compare in terms of link time
>   performance compared to linkers on other systems?

It's completely I/O bound, which means we aren't wasting too much time doing the
actual linking, just the writing and reading.

That said, it could benefit from some performance optimization on the
reading and writing part.
> 
> Thanks.
> -- 
> Craig Rodrigues        
> http://www.gis.net/~craigr    
> rodrigc@mediaone.net          

-- 
When I was little, my grandfather used to make me stand in a
closet for five minutes without moving.  He said it was elevator
practice.



More information about the Gcc mailing list