Problems building on SunOS

Brian Warner warner at lothar.com
Sat Sep 5 20:04:28 CEST 1998


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:

17:warner at snurfle% gmake
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../intl -I../intl  -g -Wall -shared  -fPIC -o tiger tiger.c
18:warner at snurfle% nm tiger |grep muldi
[68]    |         0|       0|NOTY |GLOB |0    |UNDEF  |__muldi3
19:warner at snurfle% gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../intl -g -Wall -shared -fPIC -o tiger tiger.c -lgcc
Text relocation remains                       referenced
    against symbol                  offset      in file
.umul                               0xb0        /import/tools/packages/gcc-2.7.2.2/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2.2/libgcc.a(_muldi3.o)
.umul                               0xc0        /import/tools/packages/gcc-2.7.2.2/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2.2/libgcc.a(_muldi3.o)
ld: fatal: relocations remain against allocatable but non-writable sections
20:warner at snurfle% 

I looked at this more carefully before (-v to see what the linker was given).
I believe I had some success with doing the 'ld' by hand and removing a
certain '-z text' argument from the ld command string, but this is both
difficult to do from the gcc command string, and just plain ugly.

Not sure of a good way to do it..

 -Brian
  warner at lothar.com




More information about the Gnupg-devel mailing list