This is the mail archive of the
mailing list for the binutils project.
Re: Runtime problem with duplicate symbols
- From: nick clifton <nickc at redhat dot com>
- To: Florian Lorenzen <florian dot lorenzen at tu-berlin dot de>
- Cc: binutils at sourceware dot org
- Date: Fri, 26 Oct 2012 17:13:59 +0100
- Subject: Re: Runtime problem with duplicate symbols
- References: <5086842C.firstname.lastname@example.org>
$ gcc -o demo A.o B.o C.o -lbase
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?
Not really no. :-( You could try linking with --whole-archive. Ie:
gcc -o demo A.o B.o -Wl,--whole-archive -lbase -Wl,--no-whole-archive
This might work (I have not actually tried it). You would probably only
want to enable this during testing however as it will make your