[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / ppc32-tls-ld.s
blobd70a52affc002342856e2485f71bae049e77d91e
1 # REQUIRES: ppc
2 # RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
3 # RUN: echo '.globl __tls_get_addr; __tls_get_addr:' | llvm-mc -filetype=obj -triple=powerpc - -o %tga.o
5 # RUN: ld.lld -shared %t.o -o %t.so
6 # RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=LD-REL %s
7 # RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=LD %s
9 # RUN: ld.lld %t.o %tga.o -o %t
10 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
11 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
13 # LD-REL: .rela.dyn {
14 # LD-REL-NEXT: 0x202D0 R_PPC_DTPMOD32 - 0x0
15 # LD-REL-NEXT: }
17 ## &.got[3] - _GLOBAL_OFFSET_TABLE_ = 12
18 # LD: addi 3, 30, 12
19 # LD-NEXT: bl 0x101f8
20 ## a@dtprel = st_value(a)-0x8000 = 65540-0x8000 = 65536*1-32764
21 ## b@dtprel = st_value(a)-0x8000 = 131080-0x8000 = 65536*2-32760
22 # LD-NEXT: addis 9, 3, 1
23 # LD-NEXT: addis 10, 3, 2
24 # LD-NEXT: addi 9, 9, -32764
25 # LD-NEXT: addi 10, 10, -32760
26 ## small@dtprel = st_value(small)-0x8000 = 4-0x8000 = -32764
27 # LD-NEXT: addi 9, 3, -32764
29 ## Check that b@got@tlsld does not allocate another GOT entry.
30 ## It shares In.Got->TlsIndexOff allocated when processing a@got@tlsld.
31 ## &.got[3] - _GLOBAL_OFFSET_TABLE_ = 12
32 # LD-NEXT: addi 3, 9, 12
33 # LD-NEXT: bl 0x101f8
34 ## b@dtprel = st_value(a)-0x8000 = 131080-0x8000 = 65536*2-32760
35 # LD-NEXT: addis 29, 3, 2
36 # LD-NEXT: addi 29, 29, -32760
38 ## When producing an executable, the LD code sequence can be relaxed to LE.
39 ## It is the same as GD->LE.
40 ## tpoff(_TLS_MODULE_BASE_) = 0, tpoff(a) = -8, tpoff(b) = -4
42 # NOREL: no relocations
44 ## Set r3 to r2+4096
45 # LE: addis 3, 2, 0
46 # LE-NEXT: addi 3, 3, 4096
47 ## a@tprel = 65540-0x7000 = 65536*1-32764
48 ## b@tprel = 131080-0x7000 = 65536*2-32760
49 # LE-NEXT: addis 9, 3, 1
50 # LE-NEXT: addis 10, 3, 2
51 # LE-NEXT: addi 9, 9, -32764
52 # LE-NEXT: addi 10, 10, -32760
53 ## small@tprel = 4-0x7000 = -32764
54 # LE-NEXT: addi 9, 3, -32764
56 ## Set r3 to r2+4096
57 # LE-NEXT: addis 3, 2, 0
58 # LE-NEXT: addi 3, 3, 4096
59 ## b@tprel = 131080-0x7000 = 65536*2-32760
60 # LE-NEXT: addis 29, 3, 2
61 # LE-NEXT: addi 29, 29, -32760
63 addi 3, 30, a@got@tlsld
64 bl __tls_get_addr(a@tlsld)
65 addis 9, 3, a@dtprel@ha
66 addis 10, 3, b@dtprel@ha
67 addi 9, 9, a@dtprel@l
68 addi 10, 10, b@dtprel@l
69 addi 9, 3, small@dtprel
71 addi 3, 9, b@got@tlsld
72 bl __tls_get_addr(b@tlsld)
73 addis 29, 3, b@dtprel@ha
74 addi 29, 29, b@dtprel@l
76 .section .tbss
77 .zero 4
78 small:
79 .zero 65536
81 .zero 65540