--as-needed compile option?

Arjan van de Ven arjanv at redhat.com
Thu Mar 31 14:35:29 UTC 2005


On Thu, Mar 31, 2005 at 09:23:42AM -0500, Dan Williams wrote:
> On Thu, 2005-03-31 at 15:34 +0200, Arjan van de Ven wrote:
> > we've looked at this; one of the problems is that this needs to be a per
> > package thing; there are valid setups where --as-needed breaks (eg apps
> > that have plugins can break).
> 
> What kind of stuff do they do that breaks?  I assume that apps that use
> dlopen() have error checking for it.  Are we talking about weak-linking
> here or something? (weak linking AIUI == ld not resolving symbols until
> they are actually used)

btw the fix can be almost entirely be in pkg-config and related;
you can do -Wl,--as-needed .... libs .... -Wl,--no-as-needed

so what pkg-config needs to learn is that there are 2 types of dependencies,
normal ones and "as needed" ones, like this:

Requires: gdk-${target}-2.0
As-Needed: atk

where the later would mean that all Libs: (recursively due to deps) from
"atk" would be put inside the one global --asneeded area I described above.

optinally there could also be an

As-Needed-Libs: that also always gets put within the as-needed group, even
if the file itself wouldn't be





More information about the test mailing list