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

Re: Minimizing ld dependencies with --as-needed

On Fri, Apr 01, 2005 at 12:53:27PM +0200, Josselin Mouette wrote:

> I'm moving all my packages to use it. It's not only a workaround for
> libtool or pkgconfig bugs, it's also a great tool when some upstream
> authors gratuitously adds unneeded -l flags.

General note: you have to be careful with --as-needed if you link with
libraries having global constructors/desctuctors as these can alter the
execution of the program even if no symbol is used directly from the
library in question.

Not many libraries have constructors (at least not many C libraries,
with C++ it is much more common) so in the majority of cases this is not
an issue, but you have to be aware that you cannot just blindly add
"--as-needed" everywhere.


     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences

Reply to: