bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weak symbols & executable bloat


From: Craig Lawson
Subject: Weak symbols & executable bloat
Date: Tue, 9 Nov 2004 11:00:23 -0800

Hi Folks,
  I have an interesting problem where my executables are bloating significantly due to weak symbol resolution. Here's the scenario:
I link the code and discover that small.program is enormous. The cross-reference shows that "operator == std::basic_string, std::basic_string" is arbitrarily satisfied by H.o. Further, H.o has some references to J.o and K.o, so these are pulled in, too. And so the snowball turns into an avalanche. Yet neither H, J, nor K are required by small.program.
 
Resolution of weak symbols is apparently random -- or at least not in my control. My first thought is to break up my library into two libraries: one with only those modules needed by small.program and another with the rest. But this promises to be a maintenance pain because in reality there are more than two modules, and I have many more weak symbols than operator ==.
 
Is there some linker option which will control how weak symbols are resolved? Something along the lines of: resolve weak symbols after all strong symbols have been resolved, and try hard to resolve them from the pool of modules required by the strong symbols?
 
Best Regards,
Craig.
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]