2 # a) Linking a non-shared executable file.
3 # b) Relocations' targets are symbols defined in the shared object.
4 # c) Relocations modify a read-only section.
5 # d) The first symbol is referenced by R_MIPS32 relocation only
6 # e) The second symbol is referenced by R_MIPS_32 and R_MIPS26 relocations.
7 # f) The third symbol is referenced by R_MIPS26 and R_MIPS_32 relocations.
9 # a) There should be no R_MIPS_REL32 relocations.
10 # b) Linker creates PLT entries for all three relocations.
11 # c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require
14 # RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
15 # RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
16 # RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
17 # RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so
18 # RUN: llvm-readobj -dt -r -s %t.exe | FileCheck -check-prefix=PLT %s
22 # PLT-NEXT: Name: .rel.plt (31)
23 # PLT-NEXT: Type: SHT_REL (0x9)
24 # PLT-NEXT: Flags [ (0x2)
25 # PLT-NEXT: SHF_ALLOC (0x2)
27 # PLT-NEXT: Address: 0x400190
28 # PLT-NEXT: Offset: 0x190
32 # PLT-NEXT: AddressAlignment: 4
33 # PLT-NEXT: EntrySize: 8
37 # PLT-NEXT: Name: .plt (40)
38 # PLT-NEXT: Type: SHT_PROGBITS (0x1)
39 # PLT-NEXT: Flags [ (0x6)
40 # PLT-NEXT: SHF_ALLOC (0x2)
41 # PLT-NEXT: SHF_EXECINSTR (0x4)
43 # PLT-NEXT: Address: 0x4001B0
44 # PLT-NEXT: Offset: 0x1B0
48 # PLT-NEXT: AddressAlignment: 16
49 # PLT-NEXT: EntrySize: 0
53 # PLT-NEXT: Section (5) .rel.plt {
54 # PLT-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0
55 # PLT-NEXT: 0x40200C R_MIPS_JUMP_SLOT T2 0x0
56 # PLT-NEXT: 0x402010 R_MIPS_JUMP_SLOT T3 0x0
60 # PLT: DynamicSymbols [
62 # PLT-NEXT: Name: @ (0)
63 # PLT-NEXT: Value: 0x0
65 # PLT-NEXT: Binding: Local (0x0)
66 # PLT-NEXT: Type: None (0x0)
68 # PLT-NEXT: Section: Undefined (0x0)
71 # PLT-NEXT: Name: T1@ (1)
72 # PLT-NEXT: Value: 0x4001D0
74 # PLT-NEXT: Binding: Global (0x1)
75 # PLT-NEXT: Type: Function (0x2)
77 # PLT-NEXT: Section: Undefined (0x0)
80 # PLT-NEXT: Name: T2@ (4)
81 # PLT-NEXT: Value: 0x4001E0
83 # PLT-NEXT: Binding: Global (0x1)
84 # PLT-NEXT: Type: Function (0x2)
86 # PLT-NEXT: Section: Undefined (0x0)
89 # PLT-NEXT: Name: T3@ (7)
90 # PLT-NEXT: Value: 0x4001F0
92 # PLT-NEXT: Binding: Global (0x1)
93 # PLT-NEXT: Type: Function (0x2)
95 # PLT-NEXT: Section: Undefined (0x0)
106 Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
113 Flags: [SHF_EXECINSTR, SHF_ALLOC]
135 FileHeader: !FileHeader
140 Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
147 Flags: [SHF_EXECINSTR, SHF_ALLOC]
154 # There is no branch relocation for T1.
158 # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ...
162 # ... but R_MIPS_26 creates PLT entry and makes R_MIPS_REL32 redundant.
166 # Create PLT entry for T3 symbol.
170 # Take in account existing PLT entry and do not create R_MIPS_REL32.