-Wl,--as-needed

Ralf Corsepius rc040203 at freenet.de
Fri Jun 30 20:53:03 PDT 2006


On Fri, 2006-06-30 at 09:16 -0700, Panu Matilainen wrote:
> On Fri, 30 Jun 2006, Ralf Corsepius wrote:
> 
> > On Fri, 2006-06-30 at 13:42 +0200, Axel Thimm wrote:
> >> On Fri, Jun 30, 2006 at 11:47:29AM +0200, Ralf Corsepius wrote:
> >>> On thing I know for sure is --as-needed having occasionally failed due
> >>> to bugs somewhere.
> >>
> >>> ATM, IMO, --as-needed is a promise and probably works in many cases,
> >>> but ... one counter example (which I am 99% sure can be found - I one
> >>> had a code example, I don't have anymore) suffices to prove it as "too
> >>> unreliable".
> >>
> >> What happens when it fails?
> > Sorry, I don't recall the details (All this took place several years
> > ago).
> >
> > IIRC, it had been plain linker breakdowns during linkage and "weird
> > run-time behavior at program startup" (symbol table corruption). I don't
> > know if things have stabilized sufficiently since then.
> >
> > Another issue I recall, was people applying --as-needed to libraries
> > when combing several shared libs and interaction with --whole-archive
> > (Debian policy is to use --whole-archive on shared libs, i.e. the
> > contrary to what Fedora is tempted to do.)
> >
> > Yet another issue is portability: --as-needed is non-portable.
> 
> Right... so it's only available on reasonably new systems, is non-portable 
> and unreliable to some extent,
That's a Linux biased perspective.

>From a portability focused view, --as-needed currently is an exotic
option only available on elf-based systems and GNU-binutils based
systems, being shipped with fairly recent versions of GNU-binutils.

This excludes almost all systems but Linux and may-be some *BSD systems
no older than ca. 1-1.5 years.

>  lets just forget about it as an upstream default thingy.
Yep, a distro's upstream packaging will have to cope with it.

Ralf





More information about the Apt-Rpm mailing list