* Re: Doug Semler: collect2 or AIX ld?
[not found] <9804101602.AA25936@rios1.watson.ibm.com>
@ 1998-04-12 3:55 ` Andrey Slepuhin
0 siblings, 0 replies; only message in thread
From: Andrey Slepuhin @ 1998-04-12 3:55 UTC (permalink / raw)
To: David Edelsohn; +Cc: egcs
On 10-Apr-98 David Edelsohn wrote:
> Let me repeat the scenario. Doug has a default list of libraries
> that he links against. In some cases, libmessage is not needed and never
> referenced by the rest of his application or libraries.
>
> libmessage does depend on libstdc++ and that library is listed
> separately when needed. libmessage does have a static ctor.
>
> The new collect2 for AIX scans all libraries listed on the link
> line for static ctors, finds one in libmessage, which then calls the AIX
> linker to pull it in and either complain that libstdc++ is missing or
> require that it be listed on the commandline as well.
>
> If collect2 scan_libraries looked at the dependent libraries
> listed in the header of an executable following a preliminary link, it
> would not find libmessage and would not scan it eventhough it appeared on
> the commandline. That is one of he advantages of the previous scheme to
> parse the loader header.
Yes, I understand the scenario well. But:
1) I don't think this is good idea to put unused libraries into command line:
this cause linker overhead.
2) In general, I can imagine situation, when some work is done in constructor
of a global object in shared library without any other references
to this library (though I'm not sure that this is a good programming
style :-)).
3) For example, linux linker do the same, and I beleive that we should aim
for the same results using gnu environment on different platforms.
4) Even if egcs team will decide that we shouldn't link unreferenced
C++ shared libraries, I believe that we can do all things using single
linker pass, because collect2 has all necessary information about
symbols in objects and library.
5) What we probably should correct is the following: if shared C++ library
has no global objects with ctors/dtors and the same is true for dependent
libraries, then we shouldn't generate empty init/fini functions for such
library. This is very simple to change and this can help in Doug's case,
because he decided to avoid using a global object with ctor in his
library.
Regards,
Andrey.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1998-04-12 3:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <9804101602.AA25936@rios1.watson.ibm.com>
1998-04-12 3:55 ` Doug Semler: collect2 or AIX ld? Andrey Slepuhin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).