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 -o %t.so
9 # RUN: ld.lld %t.o %t.so -o %t.exe
10 # RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s
12 # CHECK: Relocations [
13 # CHECK-NEXT: Section ({{.*}}) .rel.dyn {
14 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_COPY data0 0x0
15 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_COPY data1 0x0
17 # CHECK-NEXT: Section ({{.*}}) .rel.plt {
18 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo0 0x0
19 # CHECK-DAG: 0x{{[0-9A-F]+}} R_MIPS_JUMP_SLOT foo1 0x0
23 # CHECK: Primary GOT {
24 # CHECK: Local entries [
26 # CHECK-NEXT: Global entries [
28 # CHECK-NEXT: Number of TLS and multi-GOT entries: 0
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
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
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.
60 lui $t0,%hi(loc) # Does not require PLT for local func.
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.
67 lui $t0,%hi(ld) # Does not require COPY rel for local data.
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.