[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / mips-plt-copy.s
blobb7eaf6fbaadf9e1837b12893d8c1a6dc2e0d9fc0
1 # REQUIRES: mips
2 # Check creating of R_MIPS_COPY and R_MIPS_JUMP_SLOT dynamic relocations
3 # and corresponding PLT entries.
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
6 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
7 # RUN: %S/Inputs/mips-dynamic.s -o %t.so.o
8 # RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so
9 # RUN: ld.lld %t.o %t.so -o %t.exe
10 # RUN: llvm-readobj -r -A %t.exe | FileCheck %s
12 # CHECK: Relocations [
13 # CHECK-NEXT: Section ({{.*}}) .rel.dyn {
14 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_COPY data0
15 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_COPY data1
16 # CHECK-NEXT: }
17 # CHECK-NEXT: Section ({{.*}}) .rel.plt {
18 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo0
19 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo1
20 # CHECK-NEXT: }
21 # CHECK-NEXT: ]
23 # CHECK: Primary GOT {
24 # CHECK: Local entries [
25 # CHECK-NEXT: ]
26 # CHECK-NEXT: Global entries [
27 # CHECK-NEXT: ]
28 # CHECK-NEXT: Number of TLS and multi-GOT entries: 0
29 # CHECK-NEXT: }
31 # CHECK: PLT GOT {
32 # CHECK: Entries [
33 # CHECK-NEXT: Entry {
34 # CHECK-NEXT: Address: 0x{{[0-9A-F]+}}
35 # CHECK-NEXT: Initial: 0x{{[0-9A-F]+}}
36 # CHECK-NEXT: Value: 0x{{[0-9A-F]+}}
37 # CHECK-NEXT: Type: Function
38 # CHECK-NEXT: Section: Undefined
39 # CHECK-NEXT: Name: foo0
40 # CHECK-NEXT: }
41 # CHECK-NEXT: Entry {
42 # CHECK-NEXT: Address: 0x{{[0-9A-F]+}}
43 # CHECK-NEXT: Initial: 0x{{[0-9A-F]+}}
44 # CHECK-NEXT: Value: 0x{{[0-9A-F]+}}
45 # CHECK-NEXT: Type: Function
46 # CHECK-NEXT: Section: Undefined
47 # CHECK-NEXT: Name: foo1
48 # CHECK-NEXT: }
49 # CHECK-NEXT: ]
50 # CHECK-NEXT: }
52 .text
53 .globl __start
54 __start:
55 lui $t0,%hi(foo0) # R_MIPS_HI16 requires JUMP_SLOT/PLT entry
56 # for DSO defined func.
57 addi $t0,$t0,%lo(foo0)
58 lui $t0,%hi(bar) # Does not require PLT for locally defined func.
59 addi $t0,$t0,%lo(bar)
60 lui $t0,%hi(loc) # Does not require PLT for local func.
61 addi $t0,$t0,%lo(loc)
63 lui $t0,%hi(data0) # R_MIPS_HI16 requires COPY rel for DSO defined data.
64 addi $t0,$t0,%lo(data0)
65 lui $t0,%hi(gd) # Does not require COPY rel for locally defined data.
66 addi $t0,$t0,%lo(gd)
67 lui $t0,%hi(ld) # Does not require COPY rel for local data.
68 addi $t0,$t0,%lo(ld)
70 .globl bar
71 .type bar, @function
72 bar:
73 nop
74 loc:
75 nop
77 .rodata
78 .globl gd
79 gd:
80 .word 0
81 ld:
82 .word data1+8 # R_MIPS_32 requires REL32 dnamic relocation
83 # for DSO defined data. For now we generate COPY one.
84 .word foo1+8 # R_MIPS_32 requires PLT entry for DSO defined func.