clang  currently does not support the new attribute __abi_tag__  introduced by gcc-5*  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
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  on systems with gcc-5*.
 With the exception of -stdlib=libc++ and if the full c++ link-interface is compiled by clang, obviously.
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  as of 2016/01/21.
It can be used as a workaround for everyone affected by simply saving it
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.
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:
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*) . The patchset for clang implements the gcc-6* version and thus does not support gcc-5*.
Author: Matthias Maier <email@example.com>
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*) .
The patchset for clang implements the gcc-6* version and is thus not fully
compatible with gcc-5*.
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.