[llvm-bugs] [Bug 40164] New: Linking error occurs if the size of TLS exceeds 16MB(24bit)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 26 20:05:37 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40164

            Bug ID: 40164
           Summary: Linking error occurs if the size of TLS exceeds
                    16MB(24bit)
           Product: new-bugs
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ueno.masakazu at jp.fujitsu.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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
$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181227/3db0d3f2/attachment.html>


More information about the llvm-bugs mailing list