<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 --- - [regression] weak_odr global crashes linker on OS X"
   href="http://llvm.org/bugs/show_bug.cgi?id=17964">17964</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[regression] weak_odr global crashes linker on OS X
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>code@klickverbot.at
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For this module

---
; ModuleID = 'booltest.ll'
@foo = weak_odr thread_local global i8 1
define i32 @main() {
    ret i32 0
}
---

running "llc -filetype=obj booltest.ll && clang booltest.o" yields:

---
0  0x10feeb098  __assert_rtn + 144
1  0x10ff78b48  ld::passes::tlvp::doPass(Options const&, ld::Internal&) + 1674
2  0x10feeb416  main + 520
3  0x10fedccd4  start + 52
A linker snapshot was created at:
    /tmp/a.out-2013-10-17-022718.ld-snapshot
ld: Assertion failed: (0 && "wrong content type for target in tlv defs"),
function doPass, file /SourceCache/ld64/ld64-136/src/ld/passes/tlvp.cpp, line
278.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
---

(LLVM r94929, ld64-136)


Because of this bug, LDC is still stuck with LLVM 3.2 on OS X (also see <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [3.3 RC] weak_odr thread_local global crashes MC for Mach-O"
   href="show_bug.cgi?id=15972">bug
15972</a>). It also means that the following is likely not going to work with Clang
either:
---
template <int N> struct Foo { __thread static int a; };
template <int N> __thread int Foo<N>::a = N;
int main() { return Foo<0>::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>