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

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

 



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.

drkirkby@smudge:[~] $ grep weakextract binutils-2.19.1.tar
drkirkby@smudge:[~] $ grep globalaudit binutils-2.19.1.tar
drkirkby@smudge:[~] $ grep redlocsym binutils-2.19.1.tar
drkirkby@smudge:[~] $ grep nolazyload binutils-2.19.1.tar
drkirkby@smudge:[~] $ 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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux