<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Linkerror with __declspec(selectany) (multiple definitions)"
   href="https://bugs.llvm.org/show_bug.cgi?id=33285">33285</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linkerror with __declspec(selectany) (multiple definitions)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>piotr.padlewski@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I get error from the linker when compiling ChakraCore 
<a href="https://github.com/Microsoft/ChakraCore">https://github.com/Microsoft/ChakraCore</a>
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
<span class="quote">>>> 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</span >


This template is defined here
<a href="https://github.com/Microsoft/ChakraCore/blob/master/lib/Common/DataStructures/UnitBitVector.h#L491">https://github.com/Microsoft/ChakraCore/blob/master/lib/Common/DataStructures/UnitBitVector.h#L491</a>

The reproduced is simple:
1. git clone <a href="mailto:git@github.com">git@github.com</a>:Microsoft/ChakraCore.git
3. cd ChakraCore
2. ./build.sh -n --cxx=[pathToBuildDir]/bin/clang++
--cc=[pathToBuildDir]/bin/clang</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>