This is the mail archive of the binutils@sources.redhat.com 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]

redefined symbols on weak binding




I have to link an archive of power-pc-eabi gcc compiled files with diab compiled
binaries and link under the diab environment.
The linker returns warnings on several symbol redefinitions (...not making an
elf).
Actually all the redefined symbols have a WEAK bind tag in their symbol table (I
expected that a symbol with a weak bind tag wasn't a reason of problems even if
no globl bind tag was found at link time).
Then I tried to understand more in weak bind tagging: I created two trivial
classes and their files...

in firstClassFile.h

#include <string>
class firstClass{
public:
     firstClass();
     ~firstClass();
private:
     string s;
};

in secondClassFile.h

#include <string>
class secondClass{
public:
     secondClass();
     ~secondClass();
private:
     string s;
};

( I voluntarily omitted their class definition files...please forgive the pseudo
code...:-) )
...compiled with:

C:/cygwin/tools/H-i686-pc-cygwin/powerpc-eabi/bin/gcc -I. -I../_mysys -mcpu=860
-fno-gnu-linker -c -x c++ firstClassFile.cc -o firstClassFile.o
C:/cygwin/tools/H-i686-pc-cygwin/powerpc-eabi/bin/gcc ...

and (using nm -p ...) I got for firstClassFile.o and secondClassFile.o some
identical symbols (constructors/destructor of called classes)
for instance:

00000000 t gcc2_compiled.
         U __terminate
         U __sjthrow
         U __extendsfdf2
00000000 T __10firstClass
         U __get_eh_context
00000000 W
__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0
00000000 W
_._t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0
000001e4 T _._10firstClass
...

00000000 t gcc2_compiled.
         U __terminate
         U __sjthrow
         U __extendsfdf2
00000000 T __11secondClass
         U __get_eh_context
00000000 W
__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0
00000000 W
_._t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0
000001e4 T _._11secondClass
...

The diab linker supports weak binded symbols. So do I get redefinition of
__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0
symbol?

Any suggestion is welcome.

Thank you in advance,
Luca.



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