<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 - clang-cl doesn't support /Qspectre"
   href="https://bugs.llvm.org/show_bug.cgi?id=40964">40964</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl doesn't support /Qspectre
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>cl.exe has spectre type 1 mitigation under /Qspectre, and apparently cmake now
(sometimes?) sets this, leading to stuff like
<a href="https://twitter.com/never_released/status/1101439626357686272">https://twitter.com/never_released/status/1101439626357686272</a>

<a href="https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/">https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/</a> describes
what the flag does.

We could maybe map it to -mspeculative-load-hardening

There's also a declspec for disabling spectre mitigations on a per-function
level: <a href="https://docs.microsoft.com/en-us/cpp/cpp/spectre?view=vs-2017">https://docs.microsoft.com/en-us/cpp/cpp/spectre?view=vs-2017</a>
<a href="https://reviews.llvm.org/D51157">https://reviews.llvm.org/D51157</a> suggests that we already have something like
this on the IR level, so adding a declspec might not be too difficult.

Finally, there's a warning (C5045) which flags where the mitigation would be
inserted:
<a href="https://devblogs.microsoft.com/cppblog/spectre-diagnostic-in-visual-studio-2017-version-15-7-preview-4/">https://devblogs.microsoft.com/cppblog/spectre-diagnostic-in-visual-studio-2017-version-15-7-preview-4/</a>
This part might be difficult.</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>