autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I test if the GNU or Sun linker is used?


From: Dr. David Kirkby
Subject: Re: How can I test if the GNU or Sun linker is used?
Date: Fri, 07 Aug 2009 03:56:25 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090218)

Russ Allbery wrote:
"Dr. David Kirkby" <address@hidden> writes:

What I have done in Sage is to test the version of the linker, to see if
it Sun or GNU. But this relies on the fact the first copy of 'ld' in the
path is the one used when building gcc. That might not be true. So
whilst my hacks do allow Sage to build with either the GNU or Sun tools,
it does require the path is set correctly. I'm sure they would break if
a mix of Sun and GNU tools are used by gcc.

It's a pain in the ass, but sadly the most robust thing for you to do is
to write configure probes that try to use the exact linker options that
you want to use and see if they work.

I've done that. Sage will build ok on Solaris if gcc is configured to use GNU or Sun tools. It could break if a mix and Sun and GNU are used.

The only place I was aware of where someone sent a flag directly to the assembler was one to suppress warnings from the assembler. I've since removed that bit of code, so hopefully its only necessary to worry about the linker.

Perhaps I can test it like this.


gcc -Wl,-flags foo.c

That s

Having thought about it more, just compiling a simple program

main()
{
}

as:

gcc -Wl,-zallextract simple.c

should return an error if the GNU linker is used, as it will not understand the -zallextract option. But it will not produce any error if gcc uses the Sun linker, since -zallextract is a valid option.


Does that seem sensible?







reply via email to

[Prev in Thread] Current Thread [Next in Thread]