[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnu linker/--no-as-needed?
From: |
Peter Rosin |
Subject: |
Re: gnu linker/--no-as-needed? |
Date: |
Wed, 08 Jan 2014 09:50:05 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
[Technically this is a Libtool question, but I'll answer here anyway]
On 2014-01-08 07:58, Harlan Stenn wrote:
> I need configure to tell me if I can use --no-as-needed or --as-needed.
>
> Right now we have been only using these flags if we're using GCC, and
> I've got a case (solaris) where gcc is calling the native loader, not
> gld.
>
> The docs for LT_PATH_LD say that macro tries to find the path to the
> linker used by $CC, and whether it is the GNU linker. But when I read
> the code for LT_PATH_LD it's sure not obvious to me how I can see if
> we're using a GNU linker.
>
> Anybody have some suggestions for me?
The last thing LT_PATH_LD does is to expand _LT_PATH_LD_GNU, which runs the
linker with -v and looks for "GNU" or "with BFD" in the output and assumes
GNU ld if that is found. The result is stored in $with_gnu_ld (and a cache
variable).
If inside configure, I think it's fairly safe to just use $with_gnu_ld,
that's probably not going to change anytime soon.
Outside configure, evaluate something like:
.../libtool --config | grep '^with_gnu_ld='
> If it matters, we're using this because we've got a situation where we
> need to force linking libgcc_s, as it must be in the executable early
> enough; if we drop privileges it's too late to call dlopen(). That's
> not entirely accurate, but it's close enough.
Cheers,
Peter