Problems building on SunOS
Brian Warner
warner at lothar.com
Tue Sep 8 23:56:51 CEST 1998
zack at rabi.phys.columbia.edu (Zack Weinberg) writes:
> On 05 Sep 1998 19:04:28 -0700, Brian Warner wrote:
> >zack at rabi.phys.columbia.edu (Zack Weinberg) writes:
> >> On Fri, 4 Sep 1998 16:26:44 -0400 (EDT), "Paul D. Smith" wrote:
> >> >%% Brian Warner <warner at lothar.com> writes:
> >> > bw> tiger.c, uses a long long multiply which, when compiled for a
> >> > bw> sparc, requires a function from -lgcc called __muldi3. Because
> >> > bw> tiger.c is compiled directly into a shared object, and because
> >> > bw> libgcc.a is not shared, tiger (the shared object) doesn't get
> >> > bw> __muldi3 included in it.
> >> >
> >> >Doh! _That's_ what caused that. I saw this too but didn't see any
> >> >obvious reason and I didn't get around to finding the problem.
> >>
> >> I don't have the source code in front of me, but this problem might go
> >> away if you add -lgcc to the linker command line when building the
> >> shared object. If you make the shared object with gcc -shared it
> >> ought to do that automatically. (You may also need magic flags for
> >> the linker.)
> >
> >I'm not sure how the flags get set up, but under solaris the -shared was
> >already present and didn't seem to help. Adding -lgcc caused other problems:
> [...]
> >ld: fatal: relocations remain against allocatable but non-writable sections
> >20:warner at snurfle%
>
> This is telling you that libgcc was not compiled PIC. You definitely
> don't want to take out the -z text; text relocations in shared
> libraries subvert the whole purpose of shared libraries.
>
> As to why that's so, you're using gcc 2.7.2.2 and I seem to remember
> this being a bug that was fixed in egcs and/or gcc 2.8. You might
> want to try one of them (I'd go with egcs myself).
>
> zw
Compiling it with egcs-1.1b worked on my Solaris-2.5.1 box without the __muldi3
hack. I don't know if it's because of the compiler handling the linker flags
better or if egcs just managed to open-code the multiply: 'nm' revealed no
__muldi3 in the resulting object. But all the tests passed.
-Brian
More information about the Gnupg-devel
mailing list