public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22063] New: link failure involving symbol visibility
@ 2005-06-14 14:18 mueller at kde dot org
2005-06-14 14:19 ` [Bug c++/22063] " mueller at kde dot org
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: mueller at kde dot org @ 2005-06-14 14:18 UTC (permalink / raw)
To: gcc-bugs
I'm experiencing a build failure in a rather complex project which boils
down to a class compiled with two different visibilities. it fails with this
error, but only when using -fPIC
linkfoo.o: In function `foo::foo()':
linkfoo.cc:(.gnu.linkonce.t._ZN3fooC1Ev[foo::foo()]+0x11): undefined reference
to `vtable for foo'
/usr/lib/gcc/i586-suse-linux/4.0.1/../../../../i586-suse-linux/bin/ld:
liblinkfoo.so: hidden symbol `vtable for foo' isn't defined
/usr/lib/gcc/i586-suse-linux/4.0.1/../../../../i586-suse-linux/bin/ld: final
link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
attaching testcase.
--
Summary: link failure involving symbol visibility
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mueller at kde dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i386-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22063
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/22063] link failure involving symbol visibility
2005-06-14 14:18 [Bug c++/22063] New: " mueller at kde dot org
@ 2005-06-14 14:19 ` mueller at kde dot org
2005-06-14 15:03 ` matz at suse dot de
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: mueller at kde dot org @ 2005-06-14 14:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mueller at kde dot org 2005-06-14 14:19 -------
Created an attachment (id=9088)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9088&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22063
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/22063] link failure involving symbol visibility
2005-06-14 14:18 [Bug c++/22063] New: " mueller at kde dot org
2005-06-14 14:19 ` [Bug c++/22063] " mueller at kde dot org
@ 2005-06-14 15:03 ` matz at suse dot de
2005-06-14 15:49 ` pinskia at gcc dot gnu dot org
2005-06-14 16:13 ` matz at suse dot de
3 siblings, 0 replies; 7+ messages in thread
From: matz at suse dot de @ 2005-06-14 15:03 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22063
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/22063] link failure involving symbol visibility
2005-06-14 14:18 [Bug c++/22063] New: " mueller at kde dot org
2005-06-14 14:19 ` [Bug c++/22063] " mueller at kde dot org
2005-06-14 15:03 ` matz at suse dot de
@ 2005-06-14 15:49 ` pinskia at gcc dot gnu dot org
2005-06-14 16:13 ` matz at suse dot de
3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 15:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-14 15:49 -------
I don't see anything wrong with the link error as you are saying that the class foo is only in liblinkfoo.so
which is not true as the vtable is in libfoo.so.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22063
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/22063] link failure involving symbol visibility
2005-06-14 14:18 [Bug c++/22063] New: " mueller at kde dot org
` (2 preceding siblings ...)
2005-06-14 15:49 ` pinskia at gcc dot gnu dot org
@ 2005-06-14 16:13 ` matz at suse dot de
3 siblings, 0 replies; 7+ messages in thread
From: matz at suse dot de @ 2005-06-14 16:13 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-04-19 19:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-22063-3563@http.gcc.gnu.org/bugzilla/>
2006-03-21 3:24 ` [Bug c++/22063] link failure involving symbol visibility jason at gcc dot gnu dot org
2006-03-21 13:59 ` matz at suse dot de
2006-04-19 19:24 ` geoffk at gcc dot gnu dot org
2005-06-14 14:18 [Bug c++/22063] New: " mueller at kde dot org
2005-06-14 14:19 ` [Bug c++/22063] " mueller at kde dot org
2005-06-14 15:03 ` matz at suse dot de
2005-06-14 15:49 ` pinskia at gcc dot gnu dot org
2005-06-14 16:13 ` matz at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).