4 # a) Linking a non-shared executable file.
5 # b) Relocations' target is a symbol defined in the shared object.
6 # c) The target symbol is referenced by both branch (R_MIPS_26)
7 # and regular (R_MIPS_32) relocations.
9 # a) There should be no R_MIPS_REL32 relocation.
10 # b) Linker creates a single PLT entry.
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-objdump -disassemble %t.exe | FileCheck -check-prefix=PLT %s
19 # RUN: llvm-readobj -dt -r %t.exe | FileCheck -check-prefix=PLT-SYM %s
21 # PLT: Disassembly of section .plt:
23 # PLT-NEXT: 400160: 40 00 1c 3c lui $gp, 64
24 # PLT-NEXT: 400164: 00 20 99 8f lw $25, 8192($gp)
25 # PLT-NEXT: 400168: 00 20 9c 27 addiu $gp, $gp, 8192
26 # PLT-NEXT: 40016c: 23 c0 1c 03 subu $24, $24, $gp
27 # PLT-NEXT: 400170: 21 78 e0 03 move $15, $ra
28 # PLT-NEXT: 400174: 82 c0 18 00 srl $24, $24, 2
29 # PLT-NEXT: 400178: 09 f8 20 03 jalr $25
30 # PLT-NEXT: 40017c: fe ff 18 27 addiu $24, $24, -2
32 # PLT-NEXT: 400180: 40 00 0f 3c lui $15, 64
33 # PLT-NEXT: 400184: 08 20 f9 8d lw $25, 8200($15)
34 # PLT-NEXT: 400188: 08 00 20 03 jr $25
35 # PLT-NEXT: 40018c: 08 20 f8 25 addiu $24, $15, 8200
37 # PLT-SYM: Relocations [
38 # PLT-SYM-NEXT: Section (5) .rel.plt {
39 # PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0
43 # PLT-SYM: Name: T1@ (1)
44 # PLT-SYM-NEXT: Value: 0x400180
45 # PLT-SYM-NEXT: Size: 0
46 # PLT-SYM-NEXT: Binding: Global (0x1)
47 # PLT-SYM-NEXT: Type: Function (0x2)
48 # PLT-SYM-NEXT: Other: 8
49 # PLT-SYM-NEXT: Section: Undefined (0x0)
58 Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
65 Flags: [SHF_EXECINSTR, SHF_ALLOC]
77 FileHeader: !FileHeader
82 Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
89 Flags: [SHF_EXECINSTR, SHF_ALLOC]
95 Flags: [SHF_WRITE, SHF_ALLOC]