[llvm-bugs] [Bug 40120] New: thread_local variables are not aligned properly on NetBSD
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 20 12:46:55 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=40120
Bug ID: 40120
Summary: thread_local variables are not aligned properly on
NetBSD
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: mgorny at gentoo.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Demonstration program:
#include <cstdio>
struct alignas(64) a {
int x;
};
void b() {
thread_local a as_tls;
printf("as tls: %p\n", &as_tls);
}
int main() {
b();
return 0;
}
The result is:
as tls: 0x7f7ff7efe068
which is clearly not aligned properly. However, clang/llvm seems to assume the
alignment will take place and generates MOVAPS instructions that segfault due
to wrong alignment.
FWIU, this is a bug in NetBSD ld.so but it's not expected to be fixed anytime
soon. Is there any chance for a short-term solution that would e.g. add make
LLVM take more TLS space and round the returned address to obtain necessary
alignment?
--
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/20181220/eafda463/attachment.html>
More information about the llvm-bugs
mailing list