Gentoo Archives: gentoo-dev

From: Samuli Suominen <ssuominen@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: LD_AS_NEEDED="1" in profiles/targets/developer/make.defaults?
Date: Sat, 03 Oct 2009 21:11:04
Message-Id: 4AC7BDEA.6070504@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: LD_AS_NEEDED="1" in profiles/targets/developer/make.defaults? by Samuli Suominen
1 Samuli Suominen wrote:
2 > Fabian Groffen wrote:
3 >> On 03-10-2009 23:27:41 +0300, Samuli Suominen wrote:
4 >>> The amount of pkgs in tree with valid code that fails with asneeded is
5 >>> close to zero. We can use this,
6 >>>
7 >>> if use userland_GNU; then
8 >>> append-ldflags -Wl,--no-as-needed
9 >>> fi
10 >>>
11 >>> logic so it won't cause you troubles. Or the obvious shorter && version
12 >>> of it.
13 >> Not really, because the userland is GNU, the compiler too, but the
14 >> linker is not. We once played with a version of append-ldflags that
15 >> tested the flag against the linker to see if it would work, but that's
16 >> expensive as well as allowing real typos/bugs to go unnoticed.
17 >>
18 >> We currently do either a CHOST check, or call ld to see if it's GNU for
19 >> all packages that hardcode -Wl,--{,no-}as-needed usage.
20 >>
21 >
22 > Ah. I wasn't aware of that.
23 >
24 > Perhaps we could add a new function to the flag-o-matic that does the
25 > CHOST check, and appends the flag, so the check code wouldn't have to be
26 > duplicated in ebuilds? It should be rather trivial.
27 >
28
29 ok, chost check would be cheap. how about,
30
31 no-as-needed() {
32 case $($(tc-getLD) -v 2>&1 </dev/null) in
33 *GNU*) # GNU ld
34 echo "-Wl,--no-as-needed" ;;
35 esac
36 }
37
38 usage: append-ldflags $(no-as-needed)

Replies