<html>
    <head>
      <base href="https://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 --- - Segfault of __thread varaible in Linux/ARM due to bug of LLVM ARM code generation"
   href="https://llvm.org/bugs/show_bug.cgi?id=27836">27836</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segfault of __thread varaible in Linux/ARM due to bug of LLVM ARM code generation
          </td>
        </tr>

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

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

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

        <tr>
          <th>Component</th>
          <td>Backend: ARM
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>leemgs@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16399" name="attach_16399" title="ARM: don't attempt to merge litpools referencing different PC-anchors.">attachment 16399</a> <a href="attachment.cgi?id=16399&action=edit" title="ARM: don't attempt to merge litpools referencing different PC-anchors.">[details]</a></span>
ARM: don't attempt to merge litpools referencing different PC-anchors.

There are four thread local storage (TLS) models in Clang/LLVM as following:
1) global-dynamic TLS model
2) local-dynamic TLS model
3) local-exec TLS model
4) initial-exec TLS model
and emulated-TLS (for Android S/W platform)??

Even though, We can build run normally with the static relocation method by
selecting the initial-exec TLS model instead of global-dynamic TLS model (by
default) , We need to run the clang application code with global-dynamic (or
local-dynamic) TLS model in order that we support some applications is working
with dlopen(3) library call.

We have found the appropriate solution for some clang/LLVM applications
including 1) __thread variables and 2) -O2/-O3 of the clang language. Could you
apply this patch to Ubuntu 14.04 LTS and Ubuntu 16.04 LTS repository?

* LLVM: Revision 268662 (ARM: don't attempt to merge litpools referencing
different PC-anchors.)
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=268662">http://llvm.org/viewvc/llvm-project?view=revision&revision=268662</a>

Below is the mailing list discussed to fix this issue.
<a href="http://lists.llvm.org/pipermail/llvm-dev/2016-May/098974.html">http://lists.llvm.org/pipermail/llvm-dev/2016-May/098974.html</a>
<a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160502/353476.html">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160502/353476.html</a>
<a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/355091.html">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/355091.html</a>
<a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356679.html">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356679.html</a>

* Before r268662:
  ubuntu@raspberrypi2#> ./corerun ./hello.exe (with -O2/-O3)
  Segmentation Fault

* After r268662:
  ubuntu@raspberrypi2#> ./corerun ./hello.exe (with -O2/-O3)
  Hello!!! Welcome to .NET Core (CoreCLR) world.!!!</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>