How does ld link against library archives?

Erik Leunissen e.leunissen@hccnet.nl
Sun Dec 11 15:54:00 GMT 2005


L.S.

Regarding the "-l" command line option for the GNU linker, the manual 
page says:

"If the archive defines a symbol which was undefined in some object 
which appeared before the archive on the command line, the linker will 
include the appropriate file(s) from the archive."

I was wondering what "include the appropriate file(s)" exactly means in 
this context. Specifically, I would like to know which code from the 
archive is being *added* to the output file [*].

- code for all symbols in the archive;
- code for those object members in the archive which hold symbols that 
are still unresolved;
- code for only those specific symbols that are still unresolved;
- ... something else ?

I'd appreciate very much if somebody clarified this.

Thanks in advance,

Erik Leunissen
==============


[*]
I emphasized "added" because imported code may be more than what is 
exactly needed for symbol resolution.




More information about the Gcc-help mailing list