150
|
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 --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s
|
|
6
|
|
7 // NORELOC: Relocations [
|
|
8 // NORELOC-NEXT: ]
|
|
9
|
173
|
10 // DISASM: <_start>:
|
150
|
11 // DISASM-NEXT: movq $-8, %rax
|
|
12 // DISASM-NEXT: movq $-8, %r15
|
|
13 // DISASM-NEXT: leaq -8(%rax), %rax
|
|
14 // DISASM-NEXT: leaq -8(%r15), %r15
|
|
15 // DISASM-NEXT: addq $-8, %rsp
|
|
16 // DISASM-NEXT: addq $-8, %r12
|
|
17 // DISASM-NEXT: movq $-4, %rax
|
|
18 // DISASM-NEXT: movq $-4, %r15
|
|
19 // DISASM-NEXT: leaq -4(%rax), %rax
|
|
20 // DISASM-NEXT: leaq -4(%r15), %r15
|
|
21 // DISASM-NEXT: addq $-4, %rsp
|
|
22 // DISASM-NEXT: addq $-4, %r12
|
|
23
|
|
24 // LD to LE:
|
|
25 // DISASM-NEXT: movq %fs:0, %rax
|
|
26 // DISASM-NEXT: leaq -8(%rax), %rcx
|
|
27 // DISASM-NEXT: movq %fs:0, %rax
|
|
28 // DISASM-NEXT: leaq -4(%rax), %rcx
|
|
29
|
|
30 // GD to LE:
|
|
31 // DISASM-NEXT: movq %fs:0, %rax
|
|
32 // DISASM-NEXT: leaq -8(%rax), %rax
|
|
33 // DISASM-NEXT: movq %fs:0, %rax
|
|
34 // DISASM-NEXT: leaq -4(%rax), %rax
|
|
35
|
|
36 // LD to LE:
|
173
|
37 // DISASM: <_DTPOFF64_1>:
|
150
|
38 // DISASM-NEXT: clc
|
173
|
39 // DISASM: <_DTPOFF64_2>:
|
150
|
40 // DISASM-NEXT: cld
|
|
41
|
|
42 .type tls0,@object
|
|
43 .section .tbss,"awT",@nobits
|
|
44 .globl tls0
|
|
45 .align 4
|
|
46 tls0:
|
|
47 .long 0
|
|
48 .size tls0, 4
|
|
49
|
|
50 .type tls1,@object
|
|
51 .globl tls1
|
|
52 .align 4
|
|
53 tls1:
|
|
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
|