]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/tls-opt-i686.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / tls-opt-i686.s
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686-pc-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:      Disassembly of section .text:
11 // DISASM-NEXT: _start:
12 // LD -> LE:
13 // DISASM-NEXT: 11000: 65 a1 00 00 00 00 movl %gs:0, %eax
14 // DISASM-NEXT: 11006: 90                nop
15 // DISASM-NEXT: 11007: 8d 74 26 00       leal (%esi,%eiz), %esi
16 // DISASM-NEXT: 1100b: 8d 90 f8 ff ff ff leal -8(%eax), %edx
17 // DISASM-NEXT: 11011: 65 a1 00 00 00 00 movl %gs:0, %eax
18 // DISASM-NEXT: 11017: 90                nop
19 // DISASM-NEXT: 11018: 8d 74 26 00       leal (%esi,%eiz), %esi
20 // DISASM-NEXT: 1101c: 8d 90 fc ff ff ff leal -4(%eax), %edx
21 // IE -> LE:
22 // 4294967288 == 0xFFFFFFF8
23 // 4294967292 == 0xFFFFFFFC
24 // DISASM-NEXT: 11022: 65 a1 00 00 00 00  movl %gs:0, %eax
25 // DISASM-NEXT: 11028: c7 c0 f8 ff ff ff  movl $4294967288, %eax
26 // DISASM-NEXT: 1102e: 65 a1 00 00 00 00  movl %gs:0, %eax
27 // DISASM-NEXT: 11034: c7 c0 fc ff ff ff  movl $4294967292, %eax
28 // DISASM-NEXT: 1103a: 65 a1 00 00 00 00  movl %gs:0, %eax
29 // DISASM-NEXT: 11040: 8d 80 f8 ff ff ff  leal -8(%eax), %eax
30 // DISASM-NEXT: 11046: 65 a1 00 00 00 00  movl %gs:0, %eax
31 // DISASM-NEXT: 1104c: 8d 80 fc ff ff ff  leal -4(%eax), %eax
32 .type tls0,@object
33 .section .tbss,"awT",@nobits
34 .globl tls0
35 .align 4
36 tls0:
37  .long 0
38  .size tls0, 4
39
40 .type  tls1,@object
41 .globl tls1
42 .align 4
43 tls1:
44  .long 0
45  .size tls1, 4
46
47 .section .text
48 .globl ___tls_get_addr
49 .type ___tls_get_addr,@function
50 ___tls_get_addr:
51
52 .section .text
53 .globl _start
54 _start:
55 //LD -> LE:
56 leal tls0@tlsldm(%ebx),%eax
57 call ___tls_get_addr@plt
58 leal tls0@dtpoff(%eax),%edx
59 leal tls1@tlsldm(%ebx),%eax
60 call ___tls_get_addr@plt
61 leal tls1@dtpoff(%eax),%edx
62 //IE -> LE:
63 movl %gs:0,%eax
64 movl tls0@gotntpoff(%ebx),%eax
65 movl %gs:0,%eax
66 movl tls1@gotntpoff(%ebx),%eax
67 movl %gs:0,%eax
68 addl tls0@gotntpoff(%ebx),%eax
69 movl %gs:0,%eax
70 addl tls1@gotntpoff(%ebx),%eax