From fd5b2346cce2a0dba21520217b7f8c13b7b0f6c9 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Tue, 3 Jun 2014 09:59:42 +0000 Subject: [PATCH] [Mips] Make la25-stub.test self contained. No functional changes. llvm-svn: 210094 --- lld/test/elf/Mips/Inputs/npic-obj.yaml | 56 ---------- lld/test/elf/Mips/la25-stub.test | 186 +++++++++++++++++++++++---------- 2 files changed, 130 insertions(+), 112 deletions(-) delete mode 100644 lld/test/elf/Mips/Inputs/npic-obj.yaml diff --git a/lld/test/elf/Mips/Inputs/npic-obj.yaml b/lld/test/elf/Mips/Inputs/npic-obj.yaml deleted file mode 100644 index a093de2..0000000 --- a/lld/test/elf/Mips/Inputs/npic-obj.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# Define symbols in the .text (T1N, T2N, T3N) -# and .data (D1N, D2N, D3N) sections. -# The object file has CPIC flags. -!ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_MIPS - Flags: [EF_MIPS_CPIC] - -Sections: -- Name: .text - Type: SHT_PROGBITS - Content: "000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_EXECINSTR, SHF_ALLOC] - -- Name: .data - Type: SHT_PROGBITS - Content: "000000000000000000000000" - AddressAlign: 16 - Flags: [SHF_WRITE, SHF_ALLOC] - -Symbols: - Global: - - Name: T1N - Section: .text - Type: STT_FUNC - Value: 0x0 - Size: 4 - - Name: T2N - Section: .text - Type: STT_FUNC - Value: 0x4 - Size: 4 - - Name: T3N - Section: .text - Type: STT_FUNC - Value: 0x8 - Size: 4 - - Name: D1N - Section: .data - Type: STT_OBJECT - Value: 0x0 - Size: 4 - - Name: D2N - Section: .data - Type: STT_OBJECT - Value: 0x4 - Size: 4 - - Name: D3N - Section: .data - Type: STT_OBJECT - Value: 0x8 - Size: 4 diff --git a/lld/test/elf/Mips/la25-stub.test b/lld/test/elf/Mips/la25-stub.test index 8c559c7..f0cbcc7 100644 --- a/lld/test/elf/Mips/la25-stub.test +++ b/lld/test/elf/Mips/la25-stub.test @@ -1,59 +1,133 @@ -# REQUIRES: mips - # 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 %S/Inputs/npic-obj.yaml > %t-npic-o -# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-pic-o -# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t-main-o %s -# RUN: lld -flavor gnu -target mipsel -e glob -o %t-exe \ -# RUN: %t-npic-o %t-pic-o %t-main-o -# -# RUN: llvm-objdump -disassemble %t-exe | FileCheck -check-prefix=EXE %s - -# EXE: Disassembly of section .text: -# EXE: T1N: -# EXE-NEXT: 400140: 00 00 00 00 nop - -# EXE: T1: -# EXE-NEXT: 400150: 00 00 00 00 nop - -# EXE: glob: -# EXE-NEXT: 40015c: 09 f8 20 03 jalr $25 -# EXE-NEXT: 400160: 00 00 00 00 nop - -# Jump to 'loc' label address -# EXE-NEXT: 400164: 5b 00 10 0c jal 4194668 -# EXE-NEXT: 400168: 00 00 00 00 nop -# -# EXE: loc: -# Jump to 'glob' non-pic symbol -# EXE-NEXT: 40016c: 57 00 10 0c jal 4194652 -# EXE-NEXT: 400170: 00 00 00 00 nop -# Jump to 'T1N' non-pic symbol -# EXE-NEXT: 400174: 50 00 10 0c jal 4194624 -# EXE-NEXT: 400178: 00 00 00 00 nop -# Jump to LA25 stub for 'T1' pic symbol -# EXE-NEXT: 40017c: 64 00 10 0c jal 4194704 -# EXE-NEXT: 400180: 00 00 00 00 nop -# EXE-NEXT: 400184: 00 00 00 00 nop -# EXE-NEXT: 400188: 00 00 00 00 nop -# EXE-NEXT: 40018c: 00 00 00 00 nop - -# LA25 Stub -# EXE-NEXT: 400190: 40 00 19 3c lui $25, 64 -# Jump to 'T1' label address -# EXE-NEXT: 400194: 54 00 10 08 j 4194640 -# EXE-NEXT: 400198: 50 01 39 27 addiu $25, $25, 336 -# EXE-NEXT: 40019c: 00 00 00 00 nop - - .global glob - .ent glob -glob: - jal $t9 - jal loc -loc: - jal glob - jal T1N - jal T1 - .end glob +# 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: 0x400144 +# SYM: Name: T1N (1) +# SYM-NEXT: Value: 0x400120 +# SYM: Name: T1 (5) +# SYM-NEXT: Value: 0x400130 +# SYM: Name: glob (8) +# SYM-NEXT: Value: 0x400134 + +# ASM: Contents of section .text: +# ASM-NEXT: 400120 00000000 00000000 00000000 00000000 ................ +# ASM-NEXT: 400130 00000000 00000000 00000000 4d001000 ............M... +# 0x10004d << 2 == 0x400134 (glob) --^ +# ASM-NEXT: 400140 00000000 4d001000 00000000 48001000 ....M.......H... +# ^-- 0x10004d << 2 == 0x400134 (glob) +# 0x100048 << 2 == 0x400120 (T1N) --^ +# ASM-NEXT: 400150 00000000 58001000 00000000 00000000 ....X........... +# ^-- 0x100058 << 2 == 0x400160 (T1 stub) +# ASM-NEXT: 400160 4000193c 4c001008 30013927 00000000 @..