Samuli Suominen wrote:
> Fabian Groffen wrote:
>> On 03-10-2009 23:27:41 +0300, Samuli Suominen wrote:
>>> The amount of pkgs in tree with valid code that fails with asneeded is
>>> close to zero. We can use this,
>>>
>>> if use userland_GNU; then
>>> append-ldflags -Wl,--no-as-needed
>>> fi
>>>
>>> logic so it won't cause you troubles. Or the obvious shorter && version
>>> of it.
>> Not really, because the userland is GNU, the compiler too, but the
>> linker is not. We once played with a version of append-ldflags that
>> tested the flag against the linker to see if it would work, but that's
>> expensive as well as allowing real typos/bugs to go unnoticed.
>>
>> We currently do either a CHOST check, or call ld to see if it's GNU for
>> all packages that hardcode -Wl,--{,no-}as-needed usage.
>>
>
> Ah. I wasn't aware of that.
>
> Perhaps we could add a new function to the flag-o-matic that does the
> CHOST check, and appends the flag, so the check code wouldn't have to be
> duplicated in ebuilds? It should be rather trivial.
>
ok, chost check would be cheap. how about,
no-as-needed() {
case $($(tc-getLD) -v 2>&1 </dev/null) in
*GNU*) # GNU ld
echo "-Wl,--no-as-needed" ;;
esac
}
usage: append-ldflags $(no-as-needed)