82 lines · plain
1// RUN: %clang -c -o %t %s2// RUN: %llvm_jitlink %t3//4// Test that basic ELF TLS work by adding together TLSs with values5// 0, 1, and -1, and returning the result (0 for success). This setup6// tests both zero-initialized (.tbss) and non-zero-initialized7// (.tdata) sections.8 9 .text10 .file "tlstest.cpp"11 .globl main # -- Begin function main12 .p2align 4, 0x9013 .type main,@function14main: # @main15# %bb.0: # %entry16 pushq %rbp17 movq %rsp, %rbp18 subq $32, %rsp19 movl $0, -4(%rbp)20 movl %edi, -8(%rbp)21 movq %rsi, -16(%rbp)22 data1623 leaq x@TLSGD(%rip), %rdi24 data1625 data1626 rex6427 callq __tls_get_addr@PLT28 movl (%rax), %eax29 movl %eax, -24(%rbp) # 4-byte Spill30 data1631 leaq y@TLSGD(%rip), %rdi32 data1633 data1634 rex6435 callq __tls_get_addr@PLT36 movq %rax, %rcx37 movl -24(%rbp), %eax # 4-byte Reload38 movl (%rcx), %ecx39 addl %ecx, %eax40 movl %eax, -20(%rbp) # 4-byte Spill41 data1642 leaq z@TLSGD(%rip), %rdi43 data1644 data1645 rex6446 callq __tls_get_addr@PLT47 movq %rax, %rcx48 movl -20(%rbp), %eax # 4-byte Reload49 movl (%rcx), %ecx50 addl %ecx, %eax51 addq $32, %rsp52 popq %rbp53 retq54.Lfunc_end0:55 .size main, .Lfunc_end0-main56 # -- End function57 .type x,@object # @x58 .section .tbss,"awT",@nobits59 .globl x60 .p2align 261x:62 .long 0 # 0x063 .size x, 464 65 .type y,@object # @y66 .section .tdata,"awT",@progbits67 .globl y68 .p2align 269y:70 .long 1 # 0x171 .size y, 472 73 .type z,@object # @z74 .globl z75 .p2align 276z:77 .long 4294967295 # 0xffffffff78 .size z, 479 80 .section ".note.GNU-stack","",@progbits81 .addrsig82