diff options
Diffstat (limited to 'test/old-elf/Mips/plt-header.test')
-rw-r--r-- | test/old-elf/Mips/plt-header.test | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/test/old-elf/Mips/plt-header.test b/test/old-elf/Mips/plt-header.test new file mode 100644 index 000000000000..6d303254d16d --- /dev/null +++ b/test/old-elf/Mips/plt-header.test @@ -0,0 +1,99 @@ +# REQUIRES: mips + +# Check initialization of .plt header entries. + +# Build shared library +# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o +# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o + +# Build executable +# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o +# RUN: lld -flavor old-gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so +# RUN: llvm-objdump -section-headers -disassemble %t.exe | \ +# RUN: FileCheck -check-prefix=EXE %s + +# EXE: Disassembly of section .plt: +# EXE: .plt: +# PLT0 entry. Points to the .got.plt[0] +# EXE-NEXT: 400160: 40 00 1c 3c lui $gp, 64 +# EXE-NEXT: 400164: 00 20 99 8f lw $25, 8192($gp) +# EXE-NEXT: 400168: 00 20 9c 27 addiu $gp, $gp, 8192 +# EXE-NEXT: 40016c: 23 c0 1c 03 subu $24, $24, $gp +# EXE-NEXT: 400170: 25 78 e0 03 move $15, $ra +# EXE-NEXT: 400174: 82 c0 18 00 srl $24, $24, 2 +# EXE-NEXT: 400178: 09 f8 20 03 jalr $25 +# EXE-NEXT: 40017c: fe ff 18 27 addiu $24, $24, -2 + +# EXE: Sections: +# EXE: Idx Name Size Address Type +# EXE: 6 .plt 00000030 0000000000400160 TEXT DATA +# EXE: 10 .got.plt 0000000c 0000000000402000 DATA + +# so.o +--- +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_MIPS + Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] + +Sections: + - Name: .text + Type: SHT_PROGBITS + Size: 0x0C + AddressAlign: 16 + Flags: [SHF_EXECINSTR, SHF_ALLOC] + +Symbols: + Global: + - Name: T1 + Section: .text + Type: STT_FUNC + Value: 0x0 + Size: 4 + +# o.o +--- +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_MIPS + Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC, + EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ] +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x04 + Size: 0x20 + - Name: .rel.text + Type: SHT_REL + Link: .symtab + AddressAlign: 0x04 + Info: .text + Relocations: + - Offset: 0x08 + Symbol: .text + Type: R_MIPS_26 + - Offset: 0x10 + Symbol: glob + Type: R_MIPS_26 + - Offset: 0x18 + Symbol: T1 + Type: R_MIPS_26 + +Symbols: + Local: + - Name: loc + Section: .text + Value: 0x10 + - Name: .text + Type: STT_SECTION + Section: .text + Global: + - Name: glob + Section: .text + - Name: T1 +... |