diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-03-24 21:31:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-03-24 21:31:36 +0000 |
commit | fb911942f1434f3d1750f83f25f5e42c80e60638 (patch) | |
tree | 1678c4a4f0182e4029a86d135aa4a1b7d09e3c41 /test/elf/Mips/la25-stub.test |
Notes
Diffstat (limited to 'test/elf/Mips/la25-stub.test')
-rw-r--r-- | test/elf/Mips/la25-stub.test | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/test/elf/Mips/la25-stub.test b/test/elf/Mips/la25-stub.test new file mode 100644 index 0000000000000..2c4b26452cecb --- /dev/null +++ b/test/elf/Mips/la25-stub.test @@ -0,0 +1,133 @@ +# Check LA25 stubs creation when PIC code is called from non-PIC routines. + +# Build executable from pic and non-pic code. +# RUN: yaml2obj -format=elf -docnum 1 %s > %t-npic.o +# RUN: yaml2obj -format=elf -docnum 2 %s > %t-pic.o +# RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.o +# RUN: lld -flavor gnu -target mipsel -e glob -o %t.exe \ +# RUN: %t-npic.o %t-pic.o %t-main.o + +# RUN: llvm-readobj -t %t.exe | FileCheck -check-prefix=SYM %s +# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=ASM %s + +# SYM: Name: loc (13) +# SYM-NEXT: Value: 0x400134 +# SYM: Name: T1N (1) +# SYM-NEXT: Value: 0x400110 +# SYM: Name: T1 (5) +# SYM-NEXT: Value: 0x400120 +# SYM: Name: glob (8) +# SYM-NEXT: Value: 0x400124 + +# ASM: Contents of section .text: +# ASM-NEXT: 400110 00000000 00000000 00000000 00000000 +# ASM-NEXT: 400120 00000000 00000000 00000000 49001000 +# 0x100049 << 2 == 0x400124 (glob) --^ +# ASM-NEXT: 400130 00000000 49001000 00000000 44001000 +# ^-- 0x100049 << 2 == 0x400124 (glob) +# 0x100044 << 2 == 0x400110 (T1N) --^ +# ASM-NEXT: 400140 00000000 54001000 00000000 00000000 +# ^-- 0x100054 << 2 == 0x400150 (T1 stub) +# ASM-NEXT: 400150 4000193c 48001008 20013927 00000000 +# ^-- j 0x400120 (T1) + +# npic.o +--- +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_MIPS + Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC ] + +Sections: +- Name: .text + Type: SHT_PROGBITS + Size: 0x04 + AddressAlign: 16 + Flags: [SHF_EXECINSTR, SHF_ALLOC] + +Symbols: + Global: + - Name: T1N + Section: .text + Type: STT_FUNC + Value: 0x0 + Size: 4 + +# pic.o +--- +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_MIPS + Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_PIC ] + +Sections: +- Name: .text + Type: SHT_PROGBITS + Size: 0x04 + AddressAlign: 16 + Flags: [SHF_EXECINSTR, SHF_ALLOC] + +Symbols: + Global: + - Name: T1 + Section: .text + Type: STT_FUNC + Value: 0x0 + Size: 4 + +# main.o +--- +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_MIPS + Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC ] + +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x04 + Size: 0x28 + - Name: .rel.text + Type: SHT_REL + Link: .symtab + AddressAlign: 0x04 + Info: .text + Relocations: + - Offset: 0x08 + Symbol: .text + Type: R_MIPS_26 + Addend: 0 + - Offset: 0x10 + Symbol: glob + Type: R_MIPS_26 + Addend: 0 + - Offset: 0x18 + Symbol: T1N + Type: R_MIPS_26 + Addend: 0 + - Offset: 0x20 + Symbol: T1 + Type: R_MIPS_26 + Addend: 0 + +Symbols: + Local: + - Name: loc + Section: .text + Value: 0x10 + - Name: .text + Type: STT_SECTION + Section: .text + Global: + - Name: glob + Section: .text + - Name: T1 + - Name: T1N +... |