From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6530 invoked by alias); 14 Jun 2005 16:13:15 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6505 invoked by uid 48); 14 Jun 2005 16:13:10 -0000 Date: Tue, 14 Jun 2005 16:13:00 -0000 Message-ID: <20050614161310.6503.qmail@sourceware.org> From: "matz at suse dot de" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050614141844.22063.mueller@kde.org> References: <20050614141844.22063.mueller@kde.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/22063] link failure involving symbol visibility X-Bugzilla-Reason: CC X-SW-Source: 2005-06/txt/msg01911.txt.bz2 List-Id: ------- Additional Comments From matz at suse dot de 2005-06-14 16:13 ------- No. The vtable itself (as all methods of class foo) is implemented in libfoo.so with default visibility, i.e. exported just fine: 25: 000017d8 12 OBJECT WEAK DEFAULT 20 vtable for foo Then there is liblinkfoo, which just refers to the vtable. It is compiled with the pragma visibility in effect in the declaration of class foo (i.e. simulating a header declaring a class of a library, where the pragma was in effect). That lib is linked against the above libfoo.so. And this results in the mentioned link error. The reference to the vtable from linkfoo.o also looks just fine: 14: 00000000 0 NOTYPE GLOBAL DEFAULT UND vtable for foo i.e., UNDEF (and of course global, but that's irrelevant for a undef). This should not happen. I could theorize, that this has something to do with the two definitions of the foo::foo ctor (in linkfoo.o it's hidden of course). The "unresolvable" relocation is from that hidden implementation of foo::foo to the (global, exported in the other lib) vtable. That implementation is also placed in a linkonce section, so that might be the reason too. I changed the testcase a bit to implement the ctor out-of class, and removed the breakme method, i.e. it looks like so: ------------------------------------- #pragma GCC visibility push( hidden ) class foo { public: foo(); virtual void bar(); }; foo::foo() {} ------------------------------------- (this is linkfoo.cc) together with the other virtualclass.cc this still reproduces the same error. Here no linkonce sections are involved. The only thing is that the foo ctor is defined twice (but in different shared libs, so no problem), in the second lib hidden. It still has a reference to the vtable defined in the first lib, which is exported. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22063