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 21:51:07 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090218)

Bob Friesenhahn wrote:
On Fri, 7 Aug 2009, Dr. David Kirkby wrote:

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.

This is a useless test.

Do you have a better idea how to tell what linker gcc uses?

Quite naturally, GNU ld will try to accept (i.e. ignore) popular Solaris linker options when used under Solaris

Some popular linker options like -R and -L are accepted by both.

But a grep on the latest binutils tar file shows the more obscure options taken by the Sun linker are nowhere in the source code of the latest binutils.

All the following are linker options accepted by the Sun linker, but nowhere to be seen in the source code of the latest binutils.

address@hidden:[~] $ grep weakextract binutils-2.19.1.tar
address@hidden:[~] $ grep globalaudit binutils-2.19.1.tar
address@hidden:[~] $ grep redlocsym binutils-2.19.1.tar
address@hidden:[~] $ grep nolazyload binutils-2.19.1.tar
address@hidden:[~] $ grep preinitarray binutils-2.19.1.tar
(there are many more too.)


Hence I think it is a reasonably safe assumption that testing on an obscure Sun option will generate an error on gcc, but not on the Sun linker.

I know MPIR has a test for the linker gcc uses, but that test fails in some cases.

I'm certainly open to better suggestions, but for now at least, that is the best I can come up with.

Dave




reply via email to

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