This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How does ld link against library archives?
- From: Erik Leunissen <e dot leunissen at hccnet dot nl>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 11 Dec 2005 16:54:27 +0100
- Subject: How does ld link against library archives?
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.