[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / ppc64-tls-pcrel-gd.s
blob2ffaad0af20e9b6717deaf89d33b6c05061e924c
1 # REQUIRES: ppc
2 # RUN: split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %t/asm -o %t.o
5 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %t/defs -o %t-defs.o
6 # RUN: ld.lld --shared %t-defs.o --soname=t-defs -o %t-defs.so
7 # RUN: ld.lld -T %t/lds --shared %t.o -o %t-gd.so
8 # RUN: ld.lld -T %t/lds %t.o %t-defs.so -o %t-gdtoie
9 # RUN: ld.lld -T %t/lds %t.o %t-defs.o -o %t-gdtole
11 # RUN: llvm-readelf -r %t-gd.so | FileCheck %s --check-prefix=GD-RELOC
12 # RUN: llvm-readelf -s %t-gd.so | FileCheck %s --check-prefix=GD-SYM
13 # RUN: llvm-objdump -d --no-show-raw-insn %t-gd.so | FileCheck %s --check-prefix=GD
15 # RUN: llvm-readelf -r %t-gdtoie | FileCheck %s --check-prefix=GDTOIE-RELOC
16 # RUN: llvm-readelf -s %t-gdtoie | FileCheck %s --check-prefix=GDTOIE-SYM
17 # RUN: llvm-objdump -d --no-show-raw-insn %t-gdtoie | FileCheck %s --check-prefix=GDTOIE
19 # RUN: llvm-readelf -r %t-gdtole | FileCheck %s --check-prefix=GDTOLE-RELOC
20 # RUN: llvm-readelf -s %t-gdtole | FileCheck %s --check-prefix=GDTOLE-SYM
21 # RUN: llvm-objdump -d --no-show-raw-insn %t-gdtole | FileCheck %s --check-prefix=GDTOLE
23 ## This test checks the General Dynamic PC Relative TLS implementation for lld.
24 ## GD - General Dynamic with no relaxation possible
25 ## GDTOIE - General Dynamic relaxed to Initial Exec
26 ## GDTOLE - General Dynamic relaxed to Local Exec
28 #--- lds
29 SECTIONS {
30 .text_addr 0x1001000 : { *(.text_addr) }
33 #--- defs
34 .section .tbss,"awT",@nobits
35 .globl x
37 .long 0
38 .globl y
40 .long 0
42 #--- asm
44 # GD-RELOC: Relocation section '.rela.dyn' at offset 0x100b8 contains 4 entries:
45 # GD-RELOC: 0000000001001188 0000000100000044 R_PPC64_DTPMOD64 0000000000000000 x + 0
46 # GD-RELOC: 0000000001001190 000000010000004e R_PPC64_DTPREL64 0000000000000000 x + 0
47 # GD-RELOC: 0000000001001198 0000000300000044 R_PPC64_DTPMOD64 0000000000000000 y + 0
48 # GD-RELOC: 00000000010011a0 000000030000004e R_PPC64_DTPREL64 0000000000000000 y + 0
50 # GD-SYM: Symbol table '.dynsym' contains 4 entries:
51 # GD-SYM: 0000000000000000 0 TLS GLOBAL DEFAULT UND x
52 # GD-SYM: 0000000000000000 0 TLS GLOBAL DEFAULT UND y
55 # GDTOIE-RELOC: Relocation section '.rela.dyn' at offset 0x{{.*}} contains 2 entries:
56 # GDTOIE-RELOC: 00000000010010f8 0000000100000049 R_PPC64_TPREL64 0000000000000000 x + 0
57 # GDTOIE-RELOC: 0000000001001100 0000000300000049 R_PPC64_TPREL64 0000000000000000 y + 0
59 # GDTOIE-SYM: Symbol table '.dynsym' contains 4 entries:
60 # GDTOIE-SYM: 0000000000000000 0 TLS GLOBAL DEFAULT UND x
61 # GDTOIE-SYM: 0000000000000000 0 TLS GLOBAL DEFAULT UND y
64 # GDTOLE-RELOC: There are no relocations in this file.
66 # GDTOLE-SYM: Symbol table '.symtab' contains 5 entries:
67 # GDTOLE-SYM: 0000000000000000 0 TLS GLOBAL DEFAULT 3 x
68 # GDTOLE-SYM: 0000000000000004 0 TLS GLOBAL DEFAULT 3 y
70 # GD-LABEL: <GDTwoVal>:
71 # GD-NEXT: paddi 3, 0, 392, 1
72 # GD-NEXT: bl
73 # GD-NEXT: paddi 3, 0, 396, 1
74 # GD-NEXT: bl
75 # GD-NEXT: blr
76 # GDTOIE-LABEL: <GDTwoVal>:
77 # GDTOIE-NEXT: pld 3, 248(0), 1
78 # GDTOIE-NEXT: add 3, 3, 13
79 # GDTOIE-NEXT: pld 3, 244(0), 1
80 # GDTOIE-NEXT: add 3, 3, 13
81 # GDTOIE-NEXT: blr
82 # GDTOLE-LABEL: <GDTwoVal>:
83 # GDTOLE-NEXT: paddi 3, 13, -28672, 0
84 # GDTOLE-NEXT: nop
85 # GDTOLE-NEXT: paddi 3, 13, -28668, 0
86 # GDTOLE-NEXT: nop
87 # GDTOLE-NEXT: blr
88 .section .text_addr, "ax", %progbits
89 GDTwoVal:
90 paddi 3, 0, x@got@tlsgd@pcrel, 1
91 bl __tls_get_addr@notoc(x@tlsgd)
92 paddi 3, 0, y@got@tlsgd@pcrel, 1
93 bl __tls_get_addr@notoc(y@tlsgd)
94 blr