equivalent to '-fini' and '-init' for Sun ld?

Heiko Nardmann h.nardmann@secunet.de
Mon Aug 13 23:57:00 GMT 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am in the process of porting a project from Linux to SunOS. The project 
contains a shared object with its own _init and _fini functions. But as far 
as I can tell the Sun ld does not provide a mechanism to define _init and 
_fini. So I get the following error message:

g++ -Wall -Iinclude -DWRAP_MALLOC -DWRAP_OPEN -DWRAP_FREAD -DWRAP_FCLOSE 
- -DWRAP_FSEEK -DWRAP_STAT -DWRAP_FOPEN -DWRAP_TIME -fpic
- -fPIC -g -c source/wrapper.cpp -o obj.SunOS-sun4u/wrapper.o
g++ -Wall -g -shared -o bin.SunOS-sun4u/wrapper.so obj.SunOS-sun4u/wrapper.o 
- -ldl  -lsocket -lnsl
ld: fatal: symbol `_init' is multiply defined:
        (file /opt/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crti.o 
and file obj.SunOS-sun4u/wrapper.o);
ld: fatal: symbol `_fini' is multiply defined:
        (file /opt/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crti.o 
and file obj.SunOS-sun4u/wrapper.o);
ld: fatal: File processing errors. No output written to 
bin.SunOS-sun4u/wrapper.so
collect2: ld returned 1 exit status
make: *** [bin.SunOS-sun4u/wrapper.so] Error 1

Can anyone tell me what to do here?

Thanks in advance!

- -- 
Heiko Nardmann (Dipl.-Ing.), h.nardmann@secunet.de, Software Development
secunet Security Networks AG - Sicherheit in Netzwerken (www.secunet.de),
Weidenauer Str. 223-225, D-57076 Siegen
Tel. : +49 271 48950-13, Fax  : +49 271 48950-50
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7eMvspm53PRScYygRAqwAAKC86OJGL0Rl6xAd5BMoWbXFtpXoMwCeOTgx
iAAe+n33WuLwCCAASlsatgQ=
=EkQf
-----END PGP SIGNATURE-----



More information about the Binutils mailing list