Re: GCC and Clang produce undefined references to functions with vague linkage

2012-07-02 Thread Rafael Espíndola
> Yes, this indeed looks like (most probably my) bug in the constant folding > code that now uses extern vtables. I will fix it. So we can not take > comdat linkage decl from external vtable when we no longer have its body > around, right? Sounds about the fix John was describing, yes. You can p

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-07-02 Thread Rafael Espíndola
> not well-formed C++, for it violates the one-definition rule in that it > *lacks* a definition for the virtual member function foo::~foo(). Does > it make any difference if you add a definition? Unfortunately no. Replacing the declaration with an inline definition produces a copy of it in undef

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-07-02 Thread Alexandre Oliva
On Jun 28, 2012, Rafael Espíndola wrote: > Unfortunately, this found a bug in both gcc and clang (or in the > itanium ABI, it is not very clear). The testcase is not well-formed C++, for it violates the one-definition rule in that it *lacks* a definition for the virtual member function foo::~foo

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-07-02 Thread Jan Hubicka
Quoting John McCall : On Jun 29, 2012, at 2:23 PM, Rafael Espíndola wrote: There's no "for a long time" here. The ABI does not allow us to emit these symbols with non-coalescing linkage. We're not going to break ABI just because people didn't consider a particular code pattern when they hacke

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-06-29 Thread John McCall
On Jun 29, 2012, at 2:23 PM, Rafael Espíndola wrote: >> There's no "for a long time" here. The ABI does not allow us to emit these >> symbols with non-coalescing linkage. We're not going to break ABI >> just because people didn't consider a particular code pattern when they >> hacked in devirtual

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-06-29 Thread Rafael Espíndola
> There's no "for a long time" here.  The ABI does not allow us to emit these > symbols with non-coalescing linkage.  We're not going to break ABI > just because people didn't consider a particular code pattern when they > hacked in devirtualization through external v-tables. If we take "the ABI"

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-06-29 Thread John McCall
On Jun 29, 2012, at 11:40 AM, Rafael Espíndola wrote: >> But that's pervasively true in C++ — the linker has to eliminate duplicates >> all the time. Idiomatic C++ code ends up plunking down hundreds, if >> not thousands, of inline functions in every single translation unit. This is >> already a

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-06-29 Thread Rafael Espíndola
Richi asked me to also report a gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53808 > But that's pervasively true in C++ — the linker has to eliminate duplicates > all the time.  Idiomatic C++ code ends up plunking down hundreds, if > not thousands, of inline functions in every single tran

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-06-28 Thread John McCall
On Jun 28, 2012, at 12:12 PM, Joe Buck wrote: > On Thu, Jun 28, 2012 at 02:13:47PM -0400, Rafael Espíndola wrote: > [ problem with visibility for bar::~bar for testcase ] >> $ cat test.h >> struct foo { >> virtual ~foo(); >> }; >> struct bar : public foo { >> virtual void zed(); >> }; >> $ cat de

Re: GCC and Clang produce undefined references to functions with vague linkage

2012-06-28 Thread Joe Buck
On Thu, Jun 28, 2012 at 02:13:47PM -0400, Rafael Espíndola wrote: [ problem with visibility for bar::~bar for testcase ] > $ cat test.h > struct foo { > virtual ~foo(); > }; > struct bar : public foo { > virtual void zed(); > }; > $ cat def.cpp > #include "test.h" > void bar::zed() { > } > $ ca

GCC and Clang produce undefined references to functions with vague linkage

2012-06-28 Thread Rafael Espíndola
Note1: I am not subscribed to the gcc list, please use reply-all. Note2: I think the clang list is moderated for the first post, but it is usually really fast. Sorry about that. I recently implemented an optimization in LLVM to hide symbols that the we "know" are available in every DSO that uses t