[LLVMbugs] [Bug 23242] New: [ms] __declspec(selectany) not handled correctly for extern "C" symbols

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 15 13:36:58 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23242

            Bug ID: 23242
           Summary: [ms] __declspec(selectany) not handled correctly for
                    extern "C" symbols
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This compiles and links with both cl and clang-cl:

__declspec(selectany) int ChromeEnableBits[1];
int main() { return ChromeEnableBits[0]; }

This compiles and links fine with cl:

extern "C" __declspec(selectany) int ChromeEnableBits[1];
int main() { return ChromeEnableBits[0]; }

With clang-cl:

D:\src\llvm-ninja-rel64>bin\clang-cl foo.cc
foo-ac216e.obj : error LNK2019: unresolved external symbol ChromeEnableBits
referenced in function main
foo.exe : fatal error LNK1120: 1 unresolved externals
clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see
invocation)

Code like this is created by mc.exe, msvs's message compiler. So it's important
to match cl.exe here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150415/e9519869/attachment.html>


More information about the llvm-bugs mailing list