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

Re: -Wl,--as-needed considered possibly harmful

On Sun, Dec 09, 2007, Zack Weinberg wrote:
> I have in the past argued for --as-needed to be made the default in
> upstream binutils; that's how safe I think it is.  (Upstream
> maintainers, conscious of the above and other (isomorphic) corner
> cases, wanted a distribution to try it on a large scale first.  Thus I
> am very happy to see Debian experimenting with it.)
> I'm curious what prompted your message.  Did a program you use
> actually break?  What was the failure mode?

 When this was added to pkg-gnome at large, we were hit by at least
 toolchain issues on some arches (was it hppa?) -- now fixed -- and also
 got some borken packages.  I think gnome-panel / gnome-applets and
 gedit were the two packages that were hit when we added --as-needed.

 I think in both cases it was something like the main binary being
 linked to many utility libraries (because it was easy to link it to
 everything which configure found), and then the plugin calling directly
 into these libs, but not being linked to them.  If the main binary
 didn't actually use the libs, these were stripped out, and then the
 dlopening of the plugins would fail.
   These were really issues in the build process, issues which would
 have been caught with -z defs before --as-needed (which is why I'm
 advocating usage of -z defs before --as-needed), but slipped silently
 in the end package and actually hit users.

 I don't think there's an insanely strong incentive to make --as-needed
 the default or to not make it; distros such as Debian and Gentoo are
 using it wildly at the moment; it just can point out some surprize
 bugs in my experience.

Loïc Minier

Reply to: