<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 - Duplicate profiling symbols on Windows"
   href="https://bugs.llvm.org/show_bug.cgi?id=38251">38251</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Duplicate profiling symbols on Windows
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dmajor@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>davidxl@google.com, llvm-bugs@lists.llvm.org, llvm@inglorion.net, vsk@apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang version 7.0.0 (trunk 337473)
Target: x86_64-pc-windows-msvc

$ cat header.h
__declspec(dllimport) inline void Foo() {}
template <class T> void Bar(T) {
  Foo();
}
template void Bar(int);

$ cat a.cpp
#include "header.h"
int main() { return 0; }

$ cat b.cpp
#include "header.h"

$ clang-cl -O1 -fprofile-instr-generate -c a.cpp b.cpp
$ lld-link -nodefaultlib -entry:main a.obj b.obj

lld-link.exe: error: duplicate symbol: __profc_?Foo@@YAXXZ in a.obj and in
b.obj
lld-link.exe: error: duplicate symbol: __profd_?Foo@@YAXXZ in a.obj and in
b.obj

We've been seeing these errors while attempting to build Firefox on Windows
with PGO. Different binaries error out on different symbols. I'm not sure they
would all reduce to this same repro, but I guess fixing this one would be at
least necessary if not sufficient.

In case it's a clue: I'm pretty sure the `__declspec(dllimport)` is a common
theme among all of the problematic symbols. I don't think it's strictly
necessary to use templates though; there may be other ways to hit this.</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>