<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 - FreeBSD needs -pthread link flag for dynamic ASan tests"
   href="https://bugs.llvm.org/show_bug.cgi?id=42894">42894</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FreeBSD needs -pthread link flag for dynamic ASan tests
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </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>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When running the dynamic ASan tests on FreeBSD amd64, most of them will fail
with an error similar to:

==7913==AddressSanitizer CHECK failed: compiler-rt/lib/asan/asan_posix.cc:49
"((0)) == ((pthread_key_create(&tsd_key, destructor)))" (0x0, 0x4e)

This is because due to the dynamic linking order, the main executable will have
pthread stubs instead of the "full" pthread functions, leading to the above
error.  This can be worked around by explicitly adding -pthread or -lpthread to
the linker flags for the executables for the dynamic ASan tests.

Review with patch posted here: <a href="https://reviews.llvm.org/D39254">https://reviews.llvm.org/D39254</a></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>