Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 148879 - as-needed documentation is misleading
Summary: as-needed documentation is misleading
Status: RESOLVED FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-23 19:14 UTC by Ciaran McCreesh
Modified: 2006-10-06 10:10 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ciaran McCreesh 2006-09-23 19:14:32 UTC
http://www.gentoo.org/proj/en/qa/asneeded.xml

This document implies that use of --as-needed is beneficial and only has side effects where a package (or binutils) is broken. In particular, the "Failure in execution" implies that the cause of the problem has to be due to unlisted dependencies. This is not the case; --as-needed can also cause problems by removing dependencies that, via static initialisation, trigger behaviour modifications in other libraries (there's fuller explanation and example code at http://ciaranm.org/show_post.pl?post_id=13).

On a more idealistic note: should Gentoo be providing official documentation advocating the use of a compiler flag that is known to break correct code? Like -ffast-math, --as-needed is useful for applications which do not rely upon any of the behaviour it changes, but it causes breakage in some fully standard compliant and correct code.
Comment 1 Luca Barbato gentoo-dev 2006-09-23 19:28:25 UTC
Please report this issue also on gcc bugzilla and reopen with the upstream bug reference
Comment 2 Ciaran McCreesh 2006-09-23 19:35:45 UTC
There is no upstream bug. --as-needed does exactly what the manual says it does.
Comment 3 SpanKY gentoo-dev 2006-09-23 19:40:32 UTC
take the issue up with the binutils list as the linker should handle init/fini references
Comment 4 Ciaran McCreesh 2006-09-23 19:54:02 UTC
I don't think binutils is at fault. It's doing exactly what it says in the manual.

--as-needed isn't exactly the only compiler/linker switch that causes certain legit code to break. As far as I can see though, it's the only one still actively being promoted by Gentoo.
Comment 5 SpanKY gentoo-dev 2006-09-23 20:34:14 UTC
broken by design is still broken and doesnt mean they wont address the issue

there's nothing wrong with provding a document that covers a linker feature and provides users with correct information (rather than ugly forums threads)

if there's something missing from the documentation, you add it ... such as the init/fini case you've raised with C++ applications

no big deal
Comment 6 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-09-23 21:29:11 UTC
> On a more idealistic note: should Gentoo be providing official documentation
> advocating the use of a compiler flag that is known to break correct code? Like
> -ffast-math, --as-needed is useful for applications which do not rely upon any
> of the behaviour it changes, but it causes breakage in some fully standard
> compliant and correct code.

Gentoo promotes other behaviors that can cause breakage (the only example I can think of off hand is build-level however; as opposed to what I can only assume would be link-level).  We encourage people with SMP/distcc systems to set MAKEOPTS=-j$somehighvalue; this can break badly written build systems.  However we have intercepted the bugs relating to breakage and we filter the broken packages via setting -j1.

As long as there is someone to grab and fix the --as-needed bugs in a timely manner, I don't see a problem with us promoting it.
Comment 7 Ciaran McCreesh 2006-09-23 21:47:47 UTC
(In reply to comment #6)
> Gentoo promotes other behaviors that can cause breakage (the only example I can
> think of off hand is build-level however; as opposed to what I can only assume
> would be link-level).  We encourage people with SMP/distcc systems to set
> MAKEOPTS=-j$somehighvalue; this can break badly written build systems.  

If -jn breaks, it's a fault of the package. If --as-needed breaks, it's sometimes the fault of the linker design. There's nothing badly written or dodgy about some of the things --as-needed breaks, just as there's nothing badly written or dodgy about some of the things -ffast-math breaks.

The reason I filed this bug is because I can't think of any other dangerous behaviours that're being promoted by Gentoo (and if I could, they'd probably get bugs too...).
Comment 8 SpanKY gentoo-dev 2006-09-23 22:49:50 UTC
documenting things does not mean we are promoting them ... purposefully leaving something undocumented because it can cause troubles is close minded
Comment 9 Ciaran McCreesh 2006-10-06 09:43:03 UTC
This document is being used by users as an excuse to harass upstreams about things that are not legitimate bugs. See, for example, bug 150184 comment 3.
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-10-06 09:56:18 UTC
(From comment #3)
> take the issue up with the binutils list as the linker should handle init/fini
> references

I didn't see anything on binutils list. Hearing their version (considering they are the authors and proposers) would be the solution to this.
You can also provide an objectively sane patch to the documentation (stating that in some cases it can cause problems) would also be welcome, while it's not welcome a FUD (saying that --as-needed is always totally broken is false).

Note also that software that knows it needs the old behaviour can force it by using -Wl,--no-as-needed, although you seem to ignore this possibility for the sake of opposing to something I'm taking care (no software a part Paludis ever broke at runtime up to now).
Comment 11 SpanKY gentoo-dev 2006-10-06 10:10:40 UTC
dont be stupid Ciaran.  just because you respond on bugzilla doesnt mean he is harassing upstream.  in fact, he is doing exactly as the guide told him; report a bug on the *Gentoo* bugzilla.

added an .init/.fini section to the guide