Hi Dear Gcc developers,

    When I am trying to build Mozilla with gcc-mingw, I came across
the linkage error of undefined symbols in multiple inheritance case.
And I have made a simple test case to reproduce the problem. But the
test case is still very complex, I think. So, I came down to find the
what are the real problems. And now, I think I have, so I just
describe what I found here:

For a class hierarchy :

class SuperSuperBase {
public:
        SuperSuperBase();
        ~SuperSuperBase();

        virtual void __attribute__((__stdcall__)) funcSSB() = 0;
};

class SuperBase : public SuperSuperBase {
public:
        SuperBase();
        ~SuperBase();

        virtual void __attribute__((__stdcall__)) funcSB() = 0;
};

class Base : public SuperBase {
public:
        Base();
        ~Base();

        virtual void __attribute__((__stdcall__)) funcB() = 0;
};

class ChildA: public Base {
public:
        ChildA();
        ~ChildA();

        virtual void __attribute__((__stdcall__)) funcCA() = 0;
};

class ChildB: public SuperBase {
public:
        ChildB();
        ~ChildB();

        virtual void __attribute__((__stdcall__)) funcCB() = 0;
};

class DLL Child :       public  ChildA,
                 public  ChildB {
public:
        Child();
        ~Child();

        virtual void __attribute__((__stdcall__)) funcSSB();
        virtual void __attribute__((__stdcall__)) funcSB();
        virtual void __attribute__((__stdcall__)) funcB();
        virtual void __attribute__((__stdcall__)) funcCB();
        virtual void __attribute__((__stdcall__)) funcCA();
};

I make the Child in a DLL and then I import it from the DLL to build a
test application. But I failed with the undefined symbols of
"funcSSB,funcSB,funcCB".
And the errors occurs when I build with gcc 4.3.0 but not with gcc
3.4.2. So, I use i686-mingw32-nm to dump the object file which
contains the definition of the Child class. And for the three
undefined functions, the two compiler output different symbols,
Gcc 3.4.2:
         U __ZTVN10__cxxabiv117__class_type_infoE
         U __ZTVN10__cxxabiv120__si_class_type_infoE
         U __ZTVN10__cxxabiv121__vmi_class_type_infoE
00000000 T [EMAIL PROTECTED]
00000000 T [EMAIL PROTECTED]
00000000 T [EMAIL PROTECTED]

Gcc 4.3.0:
         U __ZTVN10__cxxabiv117__class_type_infoE
         U __ZTVN10__cxxabiv120__si_class_type_infoE
         U __ZTVN10__cxxabiv121__vmi_class_type_infoE
00000306 T __ZThn4_N5Child6funcCBEv
         U [EMAIL PROTECTED]
000002d7 T __ZThn4_N5Child6funcSBEv
         U [EMAIL PROTECTED]
000002c8 T __ZThn4_N5Child7funcSSBEv
         U [EMAIL PROTECTED]

I think the difference here is the key point of the linkage error.
Could anybody help to give some more insight here? Any advice will be
appreciated very much!

Regards!
Bo

Reply via email to