This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PATCH RFC: Recognize gold in libstdc++ configure script
Benjamin Kosnik <bkoz@redhat.com> writes:
>> It would not be appropriate for gold to simply pretend that it is GNU
>> ld. Not only is that not correct, it would actually give the
>> incorrect result. The libstdc++ configure script uses a version
>> number test to check whether the linker supports --gc-sections; gold
>> does not.
>
> OK. From what I understand, gold also does not support things like -z
> relo, right? (And the existing configure test doesn't have to be
> modified? Seems like it will work as-is.)
Right. The test for -z relro looks at the --help output, which gives
the right answer for both GNU ld and gold.
> So, your behavior is
>
> with_gnu_ld == yes for ld and gold
> glibcxx_ld_is_gold == yes for gold only
Yes.
> I would imagine that eventually you'll have to add something like
> with_gnu_ld_gold to top level, and that would subsume
> glibcxx_ld_is_gold, huh? Just curious about your longer-term
> plan. (I think libgfortran also uses -z relo so it would need
> modification to work on too.)
Most of the linker configure tests (e.g., config.guess, libtool) look
at the --help output. Of course libstdc++ has a good reason for
checking the version number. The gcc configure script also checks the
version number, but it happens to work correctly for gold through what
is essentially a lucky accident.
So I guess my general plan is to find cases which check the version
number. Where possible I want to change them to check something else,
and where not possible I want to change them to check for gold.
I'd prefer to steer away from with_gnu_ld_gold if possible. I'd
rather just have with_gnu_ld imply either. Any configure script which
checks the linker version can trivially check whether it has GNU ld or
gold, and take the appropriate action.
>> This patch fixes the problems for me. Does this seem reasonable, or
>> would people prefer a different approach?
>
> This seems reasonable to me. Thanks!
Thanks. Committed.
Ian