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]

Runtime problem with duplicate symbols


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

Hello,

I link a couple of object files (compiled from C) with the command line

$ gcc -o demo A.o B.o C.o -lbase

base is a shared library libbase.so. SO, I obtain a dynamically linked
executable.

The problem is that A.o contains a symbol _init_ATree

$ nm A.o
00000000000007e0 T init_ATree

and libbase.so also contains this symbol

$ nm libbase.so
000000000016cc60 T init_ATree

The binary is just linked fine but it crashes at runtime. The reason
is that the calls to libbase's init_ATree go to the one of A.o.

Is there any way that we get an error message and link failure at link
time such that we know that we must rename some symbols instead of
difficult bug detection?

My system:

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.22

If any additional information is required, I'll gladly provide it. In
case this list is not the appropriate place to ask, please redirect me
to a more adequate one.

I appreciate any help.

Best regards,

Florian
- -- 
Florian Lorenzen

Technische UniversitÃt Berlin
FakultÃt IV - Elektrotechnik und Informatik
Ãbersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, D-10587 Berlin

Tel.:   +49 (30) 314-24618
E-Mail: florian.lorenzen@tu-berlin.de
WWW:    http://www.user.tu-berlin.de/florenz/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCGhCwACgkQvjzICpVvX7Y7/gCdE7JY9Yxf92/sId0BITZupYEp
PCEAoJZ4n95ofPVawCw7Qkfl7vYijNYO
=zmUS
-----END PGP SIGNATURE-----


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