<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 - ld.lld overaligns TLS segment"
href="https://bugs.llvm.org/show_bug.cgi?id=41527">41527</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ld.lld overaligns TLS segment
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</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>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eleviant@accesssoftek.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>Commit r350681 introduced overalignment of TLS segment for Android
compatibility which however breaks normal AArch64/Linux images when
initial-exec TLS model is used. One possible way to implicitly enable such TLS
model is to use -fsanitize=hwaddress.
Steps to reproduce:
1. Create two C source files: main.c and so.c
/* File: so.c */
extern __thread long tlsvar;
void foo() {
tlsvar = 10;
}
/* File: main.c */
#include <assert.h>
__thread long tlsvar;
void foo();
int main() {
foo();
assert(tlsvar == 10);
return 0;
}
2. Build executable and shared object to run on Linux/AArch64:
clang -target aarch64-pc-linux -fpic -shared -ftls-model=initial-exec -o
libtlsvar.so so.c -fuse-ld=lld
clang -target aarch64-pc-linux -fpie main.c libtlsvar.so -o main -fuse-ld=bfd
3. Run main - assert will fire.</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>