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]

Re: Runtime problem with duplicate symbols


Hi Florian,

$ 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 executables bigger.

Cheers
  Nick


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