1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o 3// RUN: ld.lld %t.o -o %t1 4// RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s 5// RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s 6 7// NORELOC: Relocations [ 8// NORELOC-NEXT: ] 9 10// DISASM: _start: 11// DISASM-NEXT: 201000: 48 c7 c0 f8 ff ff ff movq $-8, %rax 12// DISASM-NEXT: 201007: 49 c7 c7 f8 ff ff ff movq $-8, %r15 13// DISASM-NEXT: 20100e: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax 14// DISASM-NEXT: 201015: 4d 8d bf f8 ff ff ff leaq -8(%r15), %r15 15// DISASM-NEXT: 20101c: 48 81 c4 f8 ff ff ff addq $-8, %rsp 16// DISASM-NEXT: 201023: 49 81 c4 f8 ff ff ff addq $-8, %r12 17// DISASM-NEXT: 20102a: 48 c7 c0 fc ff ff ff movq $-4, %rax 18// DISASM-NEXT: 201031: 49 c7 c7 fc ff ff ff movq $-4, %r15 19// DISASM-NEXT: 201038: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax 20// DISASM-NEXT: 20103f: 4d 8d bf fc ff ff ff leaq -4(%r15), %r15 21// DISASM-NEXT: 201046: 48 81 c4 fc ff ff ff addq $-4, %rsp 22// DISASM-NEXT: 20104d: 49 81 c4 fc ff ff ff addq $-4, %r12 23 24// LD to LE: 25// DISASM-NEXT: 201054: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax 26// DISASM-NEXT: 201060: 48 8d 88 f8 ff ff ff leaq -8(%rax), %rcx 27// DISASM-NEXT: 201067: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax 28// DISASM-NEXT: 201073: 48 8d 88 fc ff ff ff leaq -4(%rax), %rcx 29 30// GD to LE: 31// DISASM-NEXT: 20107a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax 32// DISASM-NEXT: 201083: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax 33// DISASM-NEXT: 20108a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax 34// DISASM-NEXT: 201093: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax 35 36// LD to LE: 37// DISASM: _DTPOFF64_1: 38// DISASM-NEXT: 20109a: f8 clc 39// DISASM: _DTPOFF64_2: 40// DISASM-NEXT: 2010a3: fc cld 41 42.type tls0,@object 43.section .tbss,"awT",@nobits 44.globl tls0 45.align 4 46tls0: 47 .long 0 48 .size tls0, 4 49 50.type tls1,@object 51.globl tls1 52.align 4 53tls1: 54 .long 0 55 .size tls1, 4 56 57.section .text 58.globl _start 59_start: 60 movq tls0@GOTTPOFF(%rip), %rax 61 movq tls0@GOTTPOFF(%rip), %r15 62 addq tls0@GOTTPOFF(%rip), %rax 63 addq tls0@GOTTPOFF(%rip), %r15 64 addq tls0@GOTTPOFF(%rip), %rsp 65 addq tls0@GOTTPOFF(%rip), %r12 66 movq tls1@GOTTPOFF(%rip), %rax 67 movq tls1@GOTTPOFF(%rip), %r15 68 addq tls1@GOTTPOFF(%rip), %rax 69 addq tls1@GOTTPOFF(%rip), %r15 70 addq tls1@GOTTPOFF(%rip), %rsp 71 addq tls1@GOTTPOFF(%rip), %r12 72 73 // LD to LE 74 leaq tls0@tlsld(%rip), %rdi 75 callq __tls_get_addr@PLT 76 leaq tls0@dtpoff(%rax),%rcx 77 leaq tls1@tlsld(%rip), %rdi 78 callq __tls_get_addr@PLT 79 leaq tls1@dtpoff(%rax),%rcx 80 81 // GD to LE 82 .byte 0x66 83 leaq tls0@tlsgd(%rip),%rdi 84 .word 0x6666 85 rex64 86 call __tls_get_addr@plt 87 .byte 0x66 88 leaq tls1@tlsgd(%rip),%rdi 89 .word 0x6666 90 rex64 91 call __tls_get_addr@plt 92 93 // LD to LE 94_DTPOFF64_1: 95 .quad tls0@DTPOFF 96 nop 97 98_DTPOFF64_2: 99 .quad tls1@DTPOFF 100 nop 101