This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/78294] [5/6/7 Regression] -fsanitize=thread broken by ignoring __attribute__((tls_model("initial-exec")))


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
...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]