X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: Date: Tue, 29 Jul 2008 14:22:12 +0800 From: "Bo Yang" To: cygwin AT cygwin DOT com Subject: Mingw gcc emit wrong symbols in multiple inheritance case MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 __ZThn4_N5Child6funcCBEv AT 4 00000000 T __ZThn4_N5Child6funcSBEv AT 4 00000000 T __ZThn4_N5Child7funcSSBEv AT 4 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 __ZThn4_N5Child6funcCBEv AT 4 000002d7 T __ZThn4_N5Child6funcSBEv U __ZThn4_N5Child6funcSBEv AT 4 000002c8 T __ZThn4_N5Child7funcSSBEv U __ZThn4_N5Child7funcSSBEv AT 4 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 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/