clang [1] currently does not support the new attribute __abi_tag__ [2] introduced by gcc-5* [3] for dual-abi support. Unfortunately, this makes clang ABI-incompatible with gcc-5*-compiled code due to different mangling of symbols (that happen to be annotated with the __abi_tag__ attribute): For example a global symbol std::string foo; is now named `foo[abi:cxx11]' by g++-5* but `foo' by clang. Gentoo enables the new dual-abi by default. This is very unfortunate because it renders clang++ (almost) useless [4] on systems with gcc-5*. [1] https://llvm.org/bugs/show_bug.cgi?id=23529 [2] https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html [3] https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html [4] With the exception of -stdlib=libc++ and if the full c++ link-interface is compiled by clang, obviously.
Added, thanks.
Sorry, wrong bug.
Created attachment 423550 [details, diff] patch that adds abi_tag support (experimental) This patch is a slightly modified version of the current state of the code review [1] as of 2016/01/21. It can be used as a workaround for everyone affected by simply saving it to /etc/portage/patches/sys-devel/llvm/ such that it gets applied through the user_patch mechanism. We should probably refrain from applying it unconditionally and wait for upstream's decision/official merge. [1] http://reviews.llvm.org/D12834
Well, at least there seems to be some upstream activity (in trunk, not in 3.8): * First part http://reviews.llvm.org/rL263015 was merged * Second part has some review activity: http://reviews.llvm.org/D18035 I wonder how a 3.8 backport would behave here...
Created attachment 440340 [details, diff] Sema part of abi tag support for LLVM
Created attachment 440342 [details, diff] Mangler part of abi tag support for LLVM
Please see the attached patches. They were taken from Arch and refreshed for dropping them into /etc/portage/patches: https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/llvm I hit bug #587640 when trying to compile rust with system-llvm USE, and realized it was due to this. Using the patches, I'm finally able to compile rust with system-llvm, so the patches do work, they probably need some testing. Note that both parts have been merged upstream now, so they should be included in 3.9.0 if I understood the workflow properly. I tried backporting the patches myself, but a lot of the stuff was against trunk, which meant some functions didn't have the same signatures. Apparently that backporting work was already done in Arch Linux.
*** Bug 587640 has been marked as a duplicate of this bug. ***
(In reply to Fabio Scaccabarozzi from comment #7) > Using the patches, I'm finally able to compile rust with system-llvm, so the > patches do work, they probably need some testing. Unfortunately, gcc-5* and gcc-6* have ABI incompatible implementations of the abi-tag feature (basically a bugfix in gcc-6*) [1]. The patchset for clang implements the gcc-6* version and thus does not support gcc-5*. [1] https://llvm.org/bugs/show_bug.cgi?id=28511
commit 6ccd97198cc1d33b13c6aa69e73ea06b69bf59d5 Author: Matthias Maier <tamiko@gentoo.org> Date: Tue Aug 2 10:19:35 2016 -0500 sys-devel/llvm: Backport abi-tag support, bug #571600 This applies the abi-tag support patches to 3.8.1-r1. Unfortunately, gcc-5* and gcc-6* have slightly ABI incompatible implementations of the abi-tag feature (basically a bugfix in gcc-6*) [1]. The patchset for clang implements the gcc-6* version and is thus not fully compatible with gcc-5*. [1] https://llvm.org/bugs/show_bug.cgi?id=28511 Package-Manager: portage-2.2.28
I think there's nothing to do for us here. The mangling support is part of current upstream releases, and gcc<6 is no longer really supported anyway.