This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Troubles linking with ld


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

Hello group...

I am dealing with creating a complicated shared object library and
then linking against it. This is on a 64-bit linux platform with
Fedora Core 3.

I compile several .c files with the following compile flags:

gcc -m64 -c -Wall -fPIC -g -o file1.o file1.c
gcc -m64 -c -Wall -fPIC -g -o file2.o file2.c
gcc -m64 -c -Wall -fPIC -g -o file3.o file3.c
gcc -m64 -c -Wall -fPIC -g -o file4.o file4.c

I then create archives:

ar rs libfiles12.a file1.o file2.o
ar rs libfiles34.a file3.o file4.o

I then compile file5.c then link to create a shared lib:

gcc -m64 -c -Wall -fPIC -O3 -o file5.o file5.c

ld -shared --whole-archive -o libnew.so file5.o libfiles12.a
libfiles34.a

Now if I write file main.cpp and want to link against libnew.so, I
have problems:

gcc -m64 -c -Wall -fPIC -g -o main.o main.cpp
ld -lc -o main main.o libnew.so
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting
to 00000000004010a0
main.o(.gnu.linkonce.d.DW.ref.__gxx_personality_v0+0x0): undefined
reference to `__gxx_personality_v0'
libnew.so: undefined reference to `fstat'

Can anyone give me any pointers on this?

Thanks,

SH
-----BEGIN PGP SIGNATURE-----
Note: This signature can be verified at https://www.hushtools.com/verify
Version: Hush 2.4

wkYEARECAAYFAkPpHQYACgkQRBFe1uc9INpZygCfWsZqmDhaXaNt081x7POFfZVMMoAA
oL6NpZnEVY24du24sgy29R4qLu5o
=0MY4
-----END PGP SIGNATURE-----



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