collect2 or AIX ld?

David Edelsohn dje@watson.ibm.com
Thu Apr 9 21:23:00 GMT 1998


>>>>> Doug Semler writes:

Doug> I was under the impression that if a library contains symbols that are
Doug> unused, the linker did not attempt to load it.  I have a library which
Doug> contains c++ code which is linked against all our code in case the
Doug> programs use the functions.  However, I get this when I try to link:

	AIX's linker is a garbage-collecting linker.  All object files and
refernced libraries are loaded, and then root symbols are traced to
determine what actually is referenced. IBM's C-Set++ has a "twolink"
option mainly meant to minimize static constructors.  I thought that
collect2 was doing something similar.

	I am not sure what interaction is occurring between libmessage and
libstdc++, but I would guess that collect2 is finding static ctors in
libmessage (and exporting them) which is pulling in that library when
listed on the link line and then that library pulls in libstdc++.

	Because of some recent changes to fix other collect2 problems,
collect2 now searches libraries listed on the linkline for static ctors as
opposed to looking at what libraries actually are referenced by the main
program during a preliminary link step. 

David



More information about the Gcc mailing list