This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SunOS shared libs ?


On Tue, 9 June 1998, 07:48:09, ram@netcom.com wrote:

 > Hi,
 > 
 > I'm getting the following failure when trying to build a shared library
 > on SunOS 4.1.2 with egcs-1.0.2:
 > 
 > ld: /usr/tmp/cca08998.o: assert pure-text failed: reference to [offset] at e5c in /usr/tmp/cca08998.o
 > 
 >     ...[several more messages of the same type] ...
 > 
 > The command was something like this:
 >     gcc -g -shared -o libXX.so *.o
 > The .o files were all compiled like this:
 >     gcc -g -O2 -ansi -pedantic -fPIC -c xyz.c

You need to add "-fPIC" to the linker command line  as well. If any of
your  *.o files  contain  static CTOR/DTORs, a   small .c file will be
generated by the  collect2 program which  in turn will be compiled and
linked into  your shared lib.  Since you  didn't specify "-fPIC"  when
linking, bloody  StunOS ld starts complaining...  Of course, using GNU
ld (e.g. from  binutils-2.9.1) would cure  this; the current  mainline
sources (the  snapshots)  address  this   differently, i.e.  you   can
continue using SunOS ld.

 > 
 > Using -fpic instead of -fPIC or using both makes no difference.
 > 
 > This works fine with gcc-2.7.2.
 > 
 > I didn't see anything in the FAQ about this. This problem occurs when
 > building my own code as well as when trying to build the FreeType
 > library. Others have reported the same problem to the freetype mailing
 > lists, so the problem does not appear to be due to any local
 > peculiarities of my setup.
 > 
 > Is this a known bug in egcs or is there some other linker or compiler
 > option that is needed ?
 > 
 > Any help is appreciated.
 > 
 > Ram

--
 Manfred Hollstein       If you have any questions about GNU software:
 Hindenburgstr. 13/1                   <mailto:manfred@s-direktnet.de>
 75446 Wiernsheim, FRG  <http://www.s-direktnet.de/HomePages/manfred/>
 PGP key:    <http://www.s-direktnet.de/HomePages/manfred/manfred.asc>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]