<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 --- - attribute alias does not honor __thread specifier"
href="http://llvm.org/bugs/show_bug.cgi?id=16901">16901</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>attribute alias does not honor __thread specifier
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haael@interia.pl
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Hello guys and ladies.
Clang 3.3 does not honor __thread specifier on an alias declaration.
How to reproduce it. First create 2 files (fileA.c and fileB.c):
====== fileA.c =========
__thread int x;
========================
====== fileB.c =========
extern __thread int y __attribute__((alias("x")));
int main(int argc, char **argv)
{
return y;
}
========================
Compile it:
clang fileA.c fileB.c
The error will be something like:
ld: x: TLS definition in /tmp/test1-HNs8cE.o section .tbss mismatches non-TLS
reference in /tmp/test2-A6WKVL.o
/tmp/test2-A6WKVL.o: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Some experiments:
If you remove BOTH __thread specifiers from the x definition in fileA.c and the
alias declaration in fileB.c, then everything will work, as clang does not
produce TLS variables.
If you remove the __thread specifier from the fileB.c, then THE RESULT WILL BE
THE SAME, thus I deduce that clang just ignores the specifier from the alias
declaration.
If you just resort to normal 'extern __thread int x' declaration in fileB.c,
then everything will work.
I suspect clang just ignores the __thread specifier in alias declarations.
I'm using clang 3.3 x86_64 compiled by gcc 4.7.1 under Slackware 14.0.</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>