[llvm-bugs] [Bug 28997] New: "non-virtual thunk" abi_tag mangling is different from g++
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 16 02:47:25 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28997
Bug ID: 28997
Summary: "non-virtual thunk" abi_tag mangling is different from
g++
Product: clang
Version: 3.9
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: joubert.sy at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Hi,
This is an upstream bug report for the following Debian bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=834492
The new mangling behavior of clang++ for GCC abi_tag attribute seems to be
different from the g++ one on some edge cases.
Consider the following code:
$ cat classes.hpp
#include <string>
struct Mother
{
virtual ~Mother() {};
int bar;
};
struct Father
{
virtual std::string get_foo() = 0;
};
class Derived:
public Mother,
public Father
{
public:
std::string get_foo();
};
$ cat classes.cpp
#include "classes.hpp"
std::string Derived::get_foo() { return ""; }
$ cat main.cpp
#include "classes.hpp"
struct Final:
public Derived
{
};
int main()
{
Final().get_foo();
}
When compiling the classes with clang++ and trying to link the executable with
g++ one gets the following link error:
$ clang++-3.9 -c classes.cpp && g++-5 main.cpp classes.o
/tmp/cchpctTt.o:main.cpp:vtable for Final : erreur : référence à « non-
virtual thunk to Derived::get_foo() » non définie
collect2: error: ld returned 1 exit status
And it seems this symbol is mangled differently by clang++ and g++:
$ clang++-3.9 -c classes.cpp && nm -C classes.o | grep get_foo
0000000000000000 T Derived::get_foo[abi:cxx11]()
0000000000000070 T non-virtual thunk to Derived::get_foo[abi:cxx11]()
$ g++-5 -c classes.cpp && nm -C classes.o | grep get_foo
0000000000000000 T Derived::get_foo[abi:cxx11]()
0000000000000065 T non-virtual thunk to Derived::get_foo()
$ g++-6 -c classes.cpp && nm -C classes.o | grep get_foo
0000000000000000 T Derived::get_foo[abi:cxx11]()
0000000000000065 T non-virtual thunk to Derived::get_foo()
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160816/fef4fb42/attachment-0001.html>
More information about the llvm-bugs
mailing list