<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 - extern thread_local and lto"
href="https://bugs.llvm.org/show_bug.cgi?id=33846">33846</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>extern thread_local and lto
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>anthony@ajrh.net
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>compiling the following into a shared library:
__attribute__ ((visibility("default"))) extern thread_local int foo;
int x() { return foo; }
generates TLS support functions:
% clang++ -std=c++11 -fPIC -shared -o x.so z.cpp && nm x.so | c++filt | grep
TLS
w TLS init function for foo
00000000000006c0 t TLS wrapper function for foo
which vanish if -flto is used:
% clang++ -flto -std=c++11 -fPIC -shared -o x.so z.cpp && nm x.so | c++filt |
grep TLS
U TLS init function for foo
=========================================
this is with current Debian testing distribution, per below
% clang++ -v -flto -std=c++11 -fPIC -shared -o x.so z.cpp
clang version 4.0.1-1 (tags/RELEASE_401/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.2
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.2.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.3.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.5.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.2.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.3.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.5.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.1.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/lib/llvm-4.0/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-llvm-bc
-flto -disable-free -disable-llvm-verifier -discard-value-names -main-file-name
z.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info
-debugger-tuning=gdb -resource-dir /usr/lib/llvm-4.0/bin/../lib/clang/4.0.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/c++/7.1.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/x86_64-linux-gnu/c++/7.1.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/x86_64-linux-gnu/c++/7.1.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/c++/7.1.0/backward
-internal-isystem /usr/include/clang/4.0.1/include/ -internal-isystem
/usr/local/include -internal-isystem
/usr/lib/llvm-4.0/bin/../lib/clang/4.0.1/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /work/ajrh/src/etp/src -ferror-limit 19
-fmessage-length 168 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/z-8e3cb3.o -x c++ z.cpp
clang -cc1 version 4.0.1 based upon LLVM 4.0.1 default target
x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory
"/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/x86_64-linux-gnu/c++/7.1.0"
ignoring duplicate directory "/usr/include/clang/4.0.1/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/c++/7.1.0
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/x86_64-linux-gnu/c++/7.1.0
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/c++/7.1.0/backward
/usr/include/clang/4.0.1/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
"/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -shared -o x.so
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../x86_64-linux-gnu/crti.o
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/crtbeginS.o
-L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0
-L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu
-L/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../..
-L/usr/lib/llvm-4.0/bin/../lib -L/lib -L/usr/lib -plugin
/usr/lib/llvm-4.0/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64
/tmp/z-8e3cb3.o -lstdc++ -lm -lgcc_s -lc -lgcc_s
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/crtendS.o
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/../../../x86_64-linux-gnu/crtn.o</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>