brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 2795eb0 Raw
89 lines · plain
1// REQUIRES: x862 3// Checks whether the TLS optimizations match the cases in Chapter 11 of4// https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf5 6// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o7// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-opt-gdie.s -o %tso.o8// RUN: ld.lld -shared %tso.o -soname=t.so -o %t.so9// RUN: ld.lld %t.o %t.so -o %t110// RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=RELOC %s11// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s12 13// RELOC:      Relocations [14// RELOC-NEXT:  Section {{.*}} .rela.dyn {15// RELOC-NEXT:    0x202420 R_X86_64_TPOFF64 tlsshared0 0x016// RELOC-NEXT:    0x202428 R_X86_64_TPOFF64 tlsshared1 0x017// RELOC-NEXT:  }18// RELOC-NEXT: ]19 20// DISASM:      <_start>:21 22// Table 11.5: GD -> IE Code Transition (LP64)23// DISASM-NEXT:               movq %fs:0, %rax24// DISASM-NEXT: 201309:       addq 4368(%rip), %rax25// DISASM-NEXT:               movq %fs:0, %rax26// DISASM-NEXT: 201319:       addq 4360(%rip), %rax27 28// Table 11.7: GD -> LE Code Transition (LP64)29// DISASM-NEXT:               movq %fs:0, %rax30// DISASM-NEXT:               leaq -8(%rax), %rax31// DISASM-NEXT:               movq %fs:0, %rax32// DISASM-NEXT:               leaq -4(%rax), %rax33 34 35// Table 11.9: LD -> LE Code Transition (LP64)36// DISASM-NEXT:               movq %fs:0, %rax37// DISASM-NEXT:               movq %fs:0, %rax38 39.type tls0,@object40.section .tbss,"awT",@nobits41.globl tls042.align 443tls0:44 .long 045 .size tls0, 446 47.type  tls1,@object48.globl tls149.align 450tls1:51 .long 052 .size tls1, 453 54.section .text55.globl _start56_start:57 // Table 11.5: GD -> IE Code Transition (LP64)58 .byte  0x6659 leaq   tlsshared0@tlsgd(%rip),%rdi60 .byte  0x6661 rex6462 call   *__tls_get_addr@GOTPCREL(%rip)63 64 .byte  0x6665 leaq   tlsshared1@tlsgd(%rip),%rdi66 .byte  0x6667 rex6468 call   *__tls_get_addr@GOTPCREL(%rip)69 70 // Table 11.7: GD -> LE Code Transition (LP64)71 .byte  0x6672 leaq   tls0@tlsgd(%rip),%rdi73 .byte  0x6674 rex6475 call   *__tls_get_addr@GOTPCREL(%rip)76 77 .byte  0x6678 leaq   tls1@tlsgd(%rip),%rdi79 .byte  0x6680 rex6481 call   *__tls_get_addr@GOTPCREL(%rip)82 83 // Table 11.9: LD -> LE Code Transition (LP64)84 leaq   tls0@tlsld(%rip),%rdi85 call   *__tls_get_addr@GOTPCREL(%rip)86 87 leaq   tls1@tlsld(%rip),%rdi88 call   *__tls_get_addr@GOTPCREL(%rip)89