<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 - Linking error occurs if the size of TLS exceeds 16MB(24bit)"
   href="https://bugs.llvm.org/show_bug.cgi?id=40164">40164</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linking error occurs if the size of TLS exceeds 16MB(24bit)
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ueno.masakazu@jp.fujitsu.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Are you planning to support options like GCC's -mtls-size={12|24|32|48} option?

If the size of TLS exceeds 16MB(24bit), a linking error occurs on ARM machine 
since it is limited to 16MB(24bit).
This problem was found in NPB(NAS Parallel Benchmarks).
In this case, it occurred in OpenMP's threadprivate, but it also occurs in C's
__thread.

GCC has -mtls-size={12|24|32|48} option. And this option changes the bit size
of the offset
 used for thread-local storage to the specified value. GCC compiller resolve it
by attaching this option.

Are you planning to support options equivalent to GCC's -mtls-size option?

The compiling logs of clang and gcc are shown below.

$ cat test.c
static char aaa[16777216];
static char bbb[16777216];
#pragma omp threadprivate(aaa,bbb)
int main() {
  aaa[0]=1;
  bbb[0]=1;
  return 0;
}

[ clang ]
$ clang test.c -fopenmp
/tmp/test-1ce537.o: In function `TLS wrapper function for bbb':
test.c:(.text+0x5c): relocation truncated to fit:
R_AARCH64_TLSLE_ADD_TPREL_HI12 against `bbb'
clang-8: error: linker command failed with exit code 1 (use -v to see
invocation)

[ GCC ]
$ gcc-8.2.0 test.c -fopenmp
/tmp/ccAeNf3i.o: In function `main':
test.c:(.text+0x18): relocation truncated to fit:
R_AARCH64_TLSLE_ADD_TPREL_HI12 against `bbb'
collect2: error: ld returned 1 exit status

$ gcc-8.2.0 test.c -fopenmp -mtls-size=48
$</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>