Bug#834492: clang-3.9: "non-virtual thunk" abi_tag mangling is different from g++
Sylvain Joubert
joubert.sy at gmail.com
Tue Aug 16 09:03:20 UTC 2016
Package: clang-3.9
Version: 1:3.9~+rc1-1~exp1
Severity: important
Dear Maintainer,
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()
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (990, 'testing'), (800, 'stable-updates'), (800, 'stable'), (700, 'unstable'), (90, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages clang-3.9 depends on:
ii binutils 2.26.1-1
ii libc6 2.23-4
ii libc6-dev 2.23-4
ii libclang-common-3.9-dev 1:3.9~+rc1-1~exp1
ii libclang1-3.9 1:3.9~+rc1-1~exp1
ii libgcc-6-dev 6.1.1-10
ii libgcc1 1:6.1.1-10
ii libllvm3.9 1:3.9~+rc1-1~exp1
ii libobjc-6-dev 6.1.1-10
ii libstdc++-6-dev 6.1.1-10
ii libstdc++6 6.1.1-10
Versions of packages clang-3.9 recommends:
ii llvm-3.9-dev 1:3.9~+rc1-1~exp1
ii python 2.7.11-2
Versions of packages clang-3.9 suggests:
pn clang-3.9-doc <none>
pn gnustep <none>
pn gnustep-devel <none>
-- no debconf information
More information about the Pkg-llvm-team
mailing list