solaris 10 with x86 - problems with static initialization

Matthew Tepel matt@tepel.org
Fri Apr 7 16:36:00 GMT 2006


It seems that currently the only way to building gcc is with version > 4 
using the solaris linker as per:

====
i?86-*-solaris2.10

Use this for Solaris 10 or later on x86 and x86-64 systems. This 
configuration is supported by GCC 4.0 and later versions only.

It is recommended that you configure GCC to use the GNU assembler in 
/usr/sfw/bin/gas but the Sun linker, using the options --with-gnu-as 
--with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld. 
====

We would like to move from linux to solaris x86 (with solaris 10). 
However up until now we have been linking our code using the -( archives 
-) option of the GNU ld.

While it appeared that /usr/ccs/bin/ld has an equivalent option called -z 
rescan, in practice it doesn't work properly.  Binaries seems to link, but 
when they run they sometimes core dump due to a static initialization 
problem.  If I take out the -z rescan for a particular binary and reorder 
the libraries the binary works.

Not using this -( archive -) option is really not an option for us so this 
is sort of a show stopper.

Not sure if others have noticed this problem.  I have confirmed this is an 
issue with the very latest solaris ld.

The real issue is I think that we would like to be able to still use the 
GNU ld on solaris x86 with solaris 10.  Is support for that actively being 
worked on?

I apologize if this is not the appropriate mailing list for this post - if 
so please direct me to a more appropriate forum.  Thanks in advance for 
your help.

-Matthew Tepel



More information about the Gcc mailing list