If compiling with GCC on another platform, say Solaris or HP-UX, can anyone say if it is better, worse or no different if the native linker is used instead of GNU ld? Thanks, David. ----- Original Message ----- From: "Ian Lance Taylor" <ian@xxxxxxxx> To: "Erik Leunissen" <e.leunissen@xxxxxxxxx> Cc: <gcc-help@xxxxxxxxxxx> Sent: Monday, December 12, 2005 3:44 AM Subject: Re: How does ld link against library archives? > Erik Leunissen <e.leunissen@xxxxxxxxx> writes: > > > Regarding the "-l" command line option for the GNU linker, the manual > > page says: > > The GNU linker is part of the binutils, and questions about it are > appropriately directed to binutils@xxxxxxxxxxxxxxx See > http://sourceware.org/binutils/ > > > "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 ? > > For each symbol which is undefined when the linker sees the archive, > for which a definition is provided by the archive, the linker will > include the complete object file which defines the symbol. If > including an object file causes the linker to see new undefined > symbols, the linker will check to see whether those symbols are > defined in the archive, and for each such symbol will include the > object file which defines it. This process is repeated until there > are no new undefined symbols which can be satisfied by the archive. > > Ian > >