Bug 1518384

Summary: __declspec(selectany) is broken in clang 5.0
Product: [Fedora] Fedora Reporter: Omair Majid <omajid>
Component: clangAssignee: Dave Airlie <airlied>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: airlied, davejohansen, nerijus, ravnzon, sbergman, siddharth.kde, tstellar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: clang-5.0.1-1.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-24 09:57:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Omair Majid 2017-11-28 19:22:03 UTC
Description of problem:

I have some code that uses the selectany attribute. It builds with clang 4.0 (Fedora 27) but now clang 5.0 (Rawhide)

See:
- https://bugs.llvm.org/show_bug.cgi?id=33285
- https://reviews.llvm.org/D33852

Version-Release number of selected component (if applicable):
clang-5.0.0-2.fc28.x86_64

How reproducible:
100%

Steps to Reproduce:
1. git clone https://github.com/dotnet/coreclr
2. cd coreclr
3. ./build.sh

Actual results:

Build fails with errors:

In file included from /home/omajid/coreclr/src/debug/createdump/createdump.cpp:5:
In file included from /home/omajid/coreclr/src/debug/createdump/createdump.h:27:
/home/omajid/coreclr/src/inc/cor.h:2210:1: error: __declspec attribute 'selectany' is not supported
      [-Werror,-Wignored-attributes]
SELECTANY const mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};
^
/home/omajid/coreclr/src/inc/cor.h:2207:41: note: expanded from macro 'SELECTANY'                                     
    #define SELECTANY extern __declspec(selectany)
                                        ^


Expected results:

Successful compilation

Additional info:

Comment 1 Tom Stellard 2017-11-28 20:16:55 UTC
This was fixed by r313278 and will be included in the upstream 5.0.1 release.

Comment 2 Omair Majid 2018-01-17 16:03:20 UTC
Any ETA on when the fix might make it into Fedora?

Comment 3 Fedora Update System 2018-01-18 16:13:27 UTC
libcxxabi-5.0.1-1.fc27 lld-5.0.1-1.fc27 libcxx-5.0.1-1.fc27 libomp-5.0.1-1.fc27 lldb-5.0.1-1.fc27 compiler-rt-5.0.1-2.fc27 clang-5.0.1-1.fc27 llvm-5.0.1-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-884ee4cdf4

Comment 4 Fedora Update System 2018-01-19 00:34:19 UTC
clang-5.0.1-1.fc27, compiler-rt-5.0.1-2.fc27, libcxx-5.0.1-1.fc27, libcxxabi-5.0.1-1.fc27, libomp-5.0.1-1.fc27, lld-5.0.1-1.fc27, lldb-5.0.1-1.fc27, llvm-5.0.1-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-884ee4cdf4

Comment 5 Nerijus Baliƫnas 2018-01-19 08:46:18 UTC
It seems compiler-rt-5.0.1-2.fc27 is not available for i686:
dnf:
 Problem 2: compiler-rt-5.0.0-1.fc27.i686 has inferior architecture
  - cannot install both compiler-rt-5.0.1-2.fc27.x86_64 and compiler-rt-5.0.0-1.fc27.x86_64
  - cannot install both compiler-rt-5.0.0-1.fc27.x86_64 and compiler-rt-5.0.1-2.fc27.x86_64
  - cannot install the best update candidate for package compiler-rt-5.0.0-1.fc27.i686
  - cannot install the best update candidate for package compiler-rt-5.0.0-1.fc27.x86_64
yum:
--> Running transaction check
---> Package compiler-rt.x86_64 0:5.0.0-1.fc27 will be updated
---> Package compiler-rt.x86_64 0:5.0.1-2.fc27 will be an update
--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:
       
         1. You have an upgrade for compiler-rt which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of compiler-rt of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude compiler-rt.otherarch ... this should give you an error
            message showing the root cause of the problem.
       
         2. You have multiple architectures of compiler-rt installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.
       
         3. You have duplicate versions of compiler-rt installed already.
            You can use "yum check" to get yum show these errors.
       
       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).
       
       Protected multilib versions: compiler-rt-5.0.1-2.fc27.x86_64 != compiler-rt-5.0.0-1.fc27.i686

Comment 6 Omair Majid 2018-01-19 17:27:34 UTC
Update works for me. Thanks!

Comment 7 Fedora Update System 2018-01-24 09:57:52 UTC
clang-5.0.1-1.fc27, compiler-rt-5.0.1-2.fc27, libcxx-5.0.1-1.fc27, libcxxabi-5.0.1-1.fc27, libomp-5.0.1-1.fc27, lld-5.0.1-1.fc27, lldb-5.0.1-1.fc27, llvm-5.0.1-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.