Re: DSO linking changes for wheezy
On Sun, Nov 14, 2010 at 10:06 AM, Roger Leigh <rleigh@codelibre.net> wrote:
> On Sun, Nov 14, 2010 at 01:51:49PM +0100, Kurt Roeckx wrote:
>> On Sun, Nov 07, 2010 at 04:19:10PM +0000, Roger Leigh wrote:
>> > On Fri, Oct 29, 2010 at 03:43:57PM +0200, Matthias Klose wrote:
>> > > For wheezy I'm planning to change the linking behaviour for DSOs (turning
>> > > on --as-needed and --no-copy-dt-needed-entries. The rationale is
>> > > summarized in http://wiki.debian.org/ToolChain/DSOLinking. I would like
>> > > to know about issues with these changes on some of the Debian ports, and
>> > > if we need to disable one of these changes on some port.
>> >
>> > While I understand the rationale for --no-copy-dt-needed-entries for
>> > preventing encapsulation violations via indirect linking, I don't agree
>> > with the use of --as-needed *at all*. If a library has been explicitly
>> > linked in, it shouldn't be removed. This is an issue for fixing in
>> > individual packages, not in the toolchain.
>> >
>> > I can understand on using it on a per-package basis, but not in the
>> > actual toolchain defaults. The compiler and linker *should not be
>> > second-guessing the user*. This can break perfectly legitimate code
>> > making use of ELF constructors and other features which won't be
>> > picked out just by looking at symbol usage.
>>
>> People have been claiming that constructors or init section are a
>> possible problem. I have yet to see an example where it breaks.
>
> It's not a very widely used feature. I'm sure it's trivial to make
> such a test case. Portable software tends not to make use of ELF-
> specific features like this, but that's not an excuse for breaking
> perfectly legitimate code.
>
> But whether or not there are real life examples, --as-needed is
> *fundamentally wrong*. It's deliberately *not doing what the user
> requested*, and to make that misfeature the system-wide default
> would be entirely inappropriate. If a package wishes to make use
> of such a feature after understanding the implications, then they
> are free to do so. But to make it the default--I don't think that's
> a technically sound decision.
Please ignore me if I've misunderstood the situation, firstly.
Both Fedora and Gentoo are using --as-needed by default now. And from
what I've read (google: site:blog.flameeyes.eu as-needed) --as-needed
is certainly useful and prevents lots of unnecessary problems.
"It's deliberately *not doing what the user requested*" -> In the case
of Gentoo, the problem is that the user himself isn't specifically
requesting all these libraries are linked in. They're specified by the
build system or .la files. If the user wants lots of libraries linked
in unnecessarily, then he can turn off --as-needed.
So, I guess I'm not understanding what the problem with --as-needed is, exactly.
Thanks,
Matt
Reply to: