collect2 or AIX ld?

Doug Semler doug@seaspace.com
Fri Apr 10 12:23:00 GMT 1998


David Edelsohn wrote:
> >>>>> 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. 
> 

Thanks, yes, my library does have a static ctor in it...solution was
to take the library out of our C program link paths and only use it in
C++ link paths :)

---
Doug Semler                       | doug@seaspace.com
SeaSpace Corporation              | Garbage In -- Gospel Out
Least Senior Software Developer;  | Minister of things to do Next Quarter
Low Man on the Totem Pole         | (but will Never Be Done) DNRC  O-
A closed mind is a terrible thing | Bus Error (passengers dumped)



More information about the Gcc mailing list