<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - -fsanitize=undefined links parts of libsanitizer into DSOs on Linux"
   href="http://llvm.org/bugs/show_bug.cgi?id=18211">18211</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-fsanitize=undefined links parts of libsanitizer into DSOs on Linux
          </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>Keywords</th>
          <td>Sanitizer
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>glider@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>eugeni.stepanov@gmail.com, kcc@google.com, llvmbugs@cs.uiuc.edu, nlewycky@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat t.c
int foo() { return 2; }
$ cat a.c
extern int foo();
int main() {  return foo(); }

$ TOOLS="-fsanitize=address -fsanitize=undefined"
$ clang t.c -shared -o t.so  -fPIC $TOOLS
$ clang a.c  -o a t.so $TOOLS
/usr/bin/ld: a: hidden symbol `pthread_self2' in
/usr/local/google/asan/llvm/llvm_cmake_build/bin/../lib/clang/3.5/lib/linux/libclang_rt.asan-x86_64.a(sanitizer_linux.cc.o)
is referenced by DSO
/usr/bin/ld: final link failed: Bad value
clang-3.4: error: linker command failed with exit code 1 (use -v to see
invocation)

If TOOLS is set to either "-fsanitize=address" or "-fsanitize=undefined" the
linking succeeds.</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>