Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 571600 - sys-devel/clang, sys-devel/llvm - ABI incompatibilty with libstdc++ from sys-devel/gcc-5* due to missing abi-tag support
Summary: sys-devel/clang, sys-devel/llvm - ABI incompatibilty with libstdc++ from sys...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal major
Assignee: LLVM support project
URL: https://llvm.org/bugs/show_bug.cgi?id...
Whiteboard:
Keywords:
: 587640 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-11 22:25 UTC by Matthias Maier
Modified: 2018-03-29 08:28 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch that adds abi_tag support (experimental) (0001-Add-abi-tag-support-1.patch,44.14 KB, patch)
2016-01-21 19:34 UTC, Matthias Maier
Details | Diff
Sema part of abi tag support for LLVM (D17567-PR23529-Sema-part-of-attrbute-abi_tag-support.patch,16.10 KB, patch)
2016-07-11 09:34 UTC, Fabio Scaccabarozzi
Details | Diff
Mangler part of abi tag support for LLVM (D18035-PR23529-Mangler-part-of-attrbute-abi_tag-support.patch,43.33 KB, patch)
2016-07-11 09:34 UTC, Fabio Scaccabarozzi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Maier gentoo-dev 2016-01-11 22:25:29 UTC
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.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-01-13 15:04:51 UTC
Added, thanks.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-01-13 15:05:28 UTC
Sorry, wrong bug.
Comment 3 Matthias Maier gentoo-dev 2016-01-21 19:34:46 UTC
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
Comment 4 Bernard Cafarelli gentoo-dev 2016-03-14 09:41:36 UTC
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...
Comment 5 Fabio Scaccabarozzi 2016-07-11 09:34:11 UTC
Created attachment 440340 [details, diff]
Sema part of abi tag support for LLVM
Comment 6 Fabio Scaccabarozzi 2016-07-11 09:34:31 UTC
Created attachment 440342 [details, diff]
Mangler part of abi tag support for LLVM
Comment 7 Fabio Scaccabarozzi 2016-07-11 09:39:10 UTC
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.
Comment 8 Doug Goldstein (RETIRED) gentoo-dev 2016-07-18 14:20:47 UTC
*** Bug 587640 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Maier gentoo-dev 2016-07-18 15:43:43 UTC
(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
Comment 10 Matthias Maier gentoo-dev 2016-08-02 17:25:25 UTC
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
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-29 08:01:15 UTC
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.