<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 - [coverage] linker failure with dead code stripping"
   href="https://bugs.llvm.org/show_bug.cgi?id=40884">40884</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[coverage] linker failure with dead code stripping
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>compile-fail, miscompilation
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Tooling
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>stefan.schmidt-bilkenroth@gemalto.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is related to <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [llvm-profdata/llvm-cov] coverage broken for C++ when built with clang-cl"
   href="show_bug.cgi?id=37561">Bug 37561</a>. The bug is fixed now, but I get linker errors
(lld-link) when building teh project with optimizer (for release).

lld-link reports about an error with relocation against "symbol" in discarded
section. This was triggered by a global function calling sprintf(), which was
not referenced. After I removed the function or replaced sprintf() with
snprintf(), linker did not complain, but the unit test was failing.

When building for Debug, the linker also did not complain, the unit test was
passing and I was able to create the coverage report.

Looks to me like dead code stripping is leading to dangling references and also
the Optimizer may cause code corruptions.

I hope Marius can reproduce the issue with his project, as I can hardly share
mine and it comes with a lot of references in our repository.

SSB</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>