This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1256592 - clang compiled binary is missing D1 constructor for classes that don't have virtual base classes
clang compiled binary is missing D1 constructor for classes that don't have v...
Status: NEW
Product: Fedora EPEL
Classification: Fedora
Component: llvm (Show other bugs)
el6
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Dave Johansen
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 975551
  Show dependency treegraph
 
Reported: 2015-08-25 01:23 EDT by Ben Woodard
Modified: 2015-12-04 14:54 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
clang compiled binary (767.51 KB, application/x-sharedlib)
2015-08-25 01:23 EDT, Ben Woodard
no flags Details
gcc compiled file (1.03 MB, application/x-sharedlib)
2015-08-25 01:26 EDT, Ben Woodard
no flags Details

  None (edit)
Description Ben Woodard 2015-08-25 01:23:41 EDT
Created attachment 1066731 [details]
clang compiled binary

Description of problem:
Dodji and I were running abidiff against an ELF file compiled by clang and we discovered that at least the version of clang that ships with EPEL has an ABI compliance bug. The bug is that for classes that have a vtable, it is supposed to have 3 destructors. D0,D1, and D2. Clang is failing to emit D1. While GCC makes D1 an alias to D2. According to Jason this is a violation of ABI

Version-Release number of selected component (if applicable):
3.4.2 I haven't yet been able to get 3.6.2 to compile.

How reproducible:
at least sometimes.

Steps to Reproduce:
1. run abidiff on the two libraries provided
2. note how it appears that GCC adds the D1 destructor as an alias to the D2 destructor For example: 

Actual results:
  [A] 'method SpinLockHolder::~SpinLockHolder(int)'    {_ZN14SpinLockHolderD1Ev, aliases _ZN14SpinLockHolderD2Ev}


Expected results:
The D1 destructor aliases the D2 destructor.

Additional info:
I believe that this only happens when you don't have a virtual base class just virtual functions
Comment 1 Ben Woodard 2015-08-25 01:26:17 EDT
Created attachment 1066732 [details]
gcc compiled file
Comment 2 Ben Woodard 2015-08-25 01:29:46 EDT
https://mentorembedded.github.io/cxx-abi/abi.html#vtable is the source that Jason cited with regards to the ABI.

If 3.6.2 doesn't have this ABI compliance problem then a reasonable solution would be just to rebase EPEL to the latest version of the compiler. Simply trying to recompile the rawhide src.rpm does not appear to work for RHEL6.
Comment 3 Dave Johansen 2015-08-25 02:23:28 EDT
clang/LLVM 3.5 and later require C++11 support and the version of gcc that comes with RHEL 6 can't be used, so I think that this will have to be fixed as "won't fix" unless someone is will to create a patch for clang/LLVM 3.4.
Comment 4 Ben Woodard 2015-08-25 11:46:51 EDT
What about compiling it with DTS?
Comment 5 Dave Johansen 2015-08-25 12:28:20 EDT
devtoolset isn't available for use in EPEL. I've tried once or twice to see if that could be possible, but it never made it anywhere ( https://lists.fedoraproject.org/pipermail/epel-devel/2013-September/008737.html ).
The best bet would be to make a COPR because then it's pretty straightforward/simple to use devtoolset. I've been wanting to do that for a while, but just haven't had the time to do it. Hopefully, I can look into it in the not too distant future.
Comment 6 Ben Woodard 2015-08-25 14:44:07 EDT
I just noticed that this also impacts constructors as can be seen by:

  'method GoogleInitializer::~GoogleInitializer(int)'    {_ZN17GoogleInitializerD1Ev, aliases _ZN17GoogleInitializerD2Ev}
  'method SpinLockHolder::SpinLockHolder(SpinLock*)'    {_ZN14SpinLockHolderC1EP8SpinLock, aliases _ZN14SpinLockHolderC2EP8SpinLock}

Note You need to log in before you can comment on or make changes to this bug.