[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / ppc64-tls-le-relax.s
blob58e83e378dc105231d57958749a1c0fbe276bee9
1 # REQUIRES: ppc
2 # RUN: split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %t/initexec -o %t/initexec.o
4 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %t/defs -o %t/defs.o
5 # RUN: ld.lld %t/initexec.o %t/defs.o -o %t/out
6 # RUN: llvm-objdump -d --no-show-raw-insn %t/out | FileCheck %s
8 # CHECK-LABEL: <GetAddrT>:
9 # CHECK: mflr 0
10 # CHECK-NEXT: std 30, -16(1)
11 # CHECK-NEXT: std 0, 16(1)
12 # CHECK-NEXT: stdu 1, -48(1)
13 # CHECK-NEXT: paddi 3, 13, -28672, 0
14 # CHECK-NEXT: mr 30, 3
15 # CHECK-NEXT: mr 3, 30
16 # CHECK-NEXT: bl
17 # CHECK-NEXT: mr 4, 30
18 # CHECK-NEXT: addi 1, 1, 48
19 # CHECK-NEXT: ld 0, 16(1)
20 # CHECK-NEXT: ld 30, -16(1)
21 # CHECK-NEXT: mtlr 0
22 # CHECK-NEXT: b
24 ## Generated From:
25 ## extern __thread unsigned TGlobal;
26 ## unsigned getConst(unsigned*);
27 ## unsigned addVal(unsigned, unsigned*);
29 ## unsigned GetAddrT() {
30 ## return addVal(getConst(&TGlobal), &TGlobal);
31 ## }
33 //--- initexec
34 GetAddrT:
35 mflr 0
36 std 30, -16(1)
37 std 0, 16(1)
38 stdu 1, -48(1)
39 pld 3, TGlobal@got@tprel@pcrel(0), 1
40 add 30, 3, TGlobal@tls@pcrel
41 mr 3, 30
42 bl getConst@notoc
43 mr 4, 30
44 addi 1, 1, 48
45 ld 0, 16(1)
46 ld 30, -16(1)
47 mtlr 0
48 b addVal@notoc
50 ## Generated From:
51 ## __thread unsigned TGlobal;
53 ## unsigned getConst(unsigned* A) {
54 ## return *A + 3;
55 ## }
57 ## unsigned addVal(unsigned A, unsigned* B) {
58 ## return A + *B;
59 ## }
61 //--- defs
62 .globl getConst
63 getConst:
64 lwz 3, 0(3)
65 addi 3, 3, 3
66 clrldi 3, 3, 32
67 blr
69 .globl addVal
70 addVal:
71 lwz 4, 0(4)
72 add 3, 4, 3
73 clrldi 3, 3, 32
74 blr
76 .section .tbss,"awT",@nobits
77 .globl TGlobal
78 .p2align 2
79 TGlobal:
80 .long 0
81 .size TGlobal, 4