[Python-Dev] Extension on Solaris: ld -G or gcc -G?
Guido van Rossum
guido@python.org
Thu, 25 May 2000 10:30:26 -0500
[Greg Ward]
> My post on this from last week was met with a deafening silence, so I
> will try to be short and to-the-point this time:
>
> Why are shared extensions on Solaris linked with "ld -G" instead of
> "gcc -G" when gcc is the compiler used to compile Python and
> extensions?
>
> Is it historical? Ie. did some versions of Solaris and/or gcc not do
> the right thing here? Could we detect that bogosity in "configure", and
> only use "ld -G" if it's necessary, and use "gcc -G" by default?
>
> The reason that using "ld -G" is the wrong thing is that libgcc.a is not
> referenced when creating the .so file. If the object code happens to
> reference functions in libgcc.a that are not referenced anywhere in the
> Python core, then importing the .so fails. This happens if there is a
> 64-bit divide in the object code. See my post of May 19 for details.
Two excuses: (1) long ago, you really needed to use ld instead of cc
to create a shared library, because cc didn't recognize the flags or
did other things that shouldn't be done to shared libraries; (2) I
didn't know there was a problem with using ld.
Since you have now provided a patch which seems to work, why don't you
check it in...?
--Guido van Rossum (home page: http://www.python.org/~guido/)