This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/78294] [5/6/7 Regression] -fsanitize=thread broken by ignoring __attribute__((tls_model("initial-exec")))
- From: "trippels at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Nov 2016 06:06:21 +0000
- Subject: [Bug middle-end/78294] [5/6/7 Regression] -fsanitize=thread broken by ignoring __attribute__((tls_model("initial-exec")))
- Auto-submitted: auto-generated
- References: <bug-78294-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294
--- Comment #14 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Here is a small testcase:
markus@x4 tsan % cat tsan_rtl.ii
__attribute__((tls_model("initial-exec"))) extern __thread char b[];
__thread char b[1];
int c;
void fn1() { c = *b; }
markus@x4 tsan % clang++ -fPIC -O2 -c tsan_rtl.ii -S -o -
...
movq b@GOTTPOFF(%rip), %rax
movsbl %fs:(%rax), %eax
movq c@GOTPCREL(%rip), %rcx
movl %eax, (%rcx)
retq
...
markus@x4 tsan % g++ -fPIC -O2 -c tsan_rtl.ii -S -o -
...
subq $8, %rsp
.cfi_def_cfa_offset 16
.byte 0x66
leaq b@tlsgd(%rip), %rdi
.value 0x6666
rex64
call __tls_get_addr@PLT
movsbl (%rax), %edx
movq c@GOTPCREL(%rip), %rax
movl %edx, (%rax)
addq $8, %rsp
...