https://bugs.llvm.org/show_bug.cgi?id=41527
Bug ID: 41527
Summary: ld.lld overaligns TLS segment
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs