[llvm-bugs] [Bug 33285] New: Linkerror with __declspec(selectany) (multiple definitions)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 2 13:18:13 PDT 2017


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

            Bug ID: 33285
           Summary: Linkerror with __declspec(selectany) (multiple
                    definitions)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: piotr.padlewski at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

I get error from the linker when compiling ChakraCore 
https://github.com/Microsoft/ChakraCore
with clang trunk. I happen with ld.gold and ld.lld. Surprisingly it doesn't
happen when compiling with clang-3.8, so clearly there is a regression.

The link error is:
/usr/bin/ld: error: duplicate symbol: BVUnitT<unsigned long>::ShiftValue
>>> defined at /home/prazek/devirtualization-results/ChakraCore/bin/GCStress/GCStress.cpp
>>>            bin/GCStress/CMakeFiles/GCStress.dir/GCStress.cpp.o:(BVUnitT<unsigned long>::ShiftValue)
>>> defined at /home/prazek/devirtualization-results/ChakraCore/lib/Common/Memory/HeapAllocator.cpp
>>>            HeapAllocator.cpp.o:(.rodata+0x4) in archive lib/libChakraCoreStatic.a


This template is defined here
https://github.com/Microsoft/ChakraCore/blob/master/lib/Common/DataStructures/UnitBitVector.h#L491

The reproduced is simple:
1. git clone git at github.com:Microsoft/ChakraCore.git
3. cd ChakraCore
2. ./build.sh -n --cxx=[pathToBuildDir]/bin/clang++
--cc=[pathToBuildDir]/bin/clang

-- 
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/20170602/1ab935aa/attachment.html>


More information about the llvm-bugs mailing list