[Mips] Cleanup and reformat test cases, add more checkings

No functional changes.

llvm-svn: 238050
This commit is contained in:
Simon Atanasyan 2015-05-22 21:08:37 +00:00
parent df94265963
commit b2f6afb30a
4 changed files with 193 additions and 165 deletions

View File

@ -5,31 +5,50 @@
# a) Emitting R_MIPS_REL32 relocations for both undefined symbols. # a) Emitting R_MIPS_REL32 relocations for both undefined symbols.
# b) There should be no PLT entries. # b) There should be no PLT entries.
# #
# RUN: yaml2obj -format=elf %s > %t-obj # RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t1-so %t-obj # RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t.so %t.o
# RUN: llvm-readobj -dt -r -s %t1-so | FileCheck -check-prefix=PLT-SYM %s # RUN: llvm-readobj -dt -r -s %t.so | FileCheck %s
# PLT-SYM: Sections [ # CHECK: Sections [
# PLT-SYM: Section { # CHECK: Section {
# PLT-SYM-NOT: Name: .plt ({{[0-9]+}}) # CHECK-NOT: Name: .plt ({{[0-9]+}})
# #
# PLT-SYM: Relocations [ # CHECK: Relocations [
# PLT-SYM-NEXT: Section (4) .rel.dyn { # CHECK-NEXT: Section (4) .rel.dyn {
# PLT-SYM-NEXT: 0x140 R_MIPS_REL32 T1 0x0 # CHECK-NEXT: 0x[[ADDR1:[0-9A-Z]+]] R_MIPS_REL32 T1 0x0
# PLT-SYM-NEXT: 0x2000 R_MIPS_REL32 T1 0x0 # CHECK-NEXT: 0x[[ADDR2:[0-9A-Z]+]] R_MIPS_REL32 T1 0x0
# PLT-SYM-NEXT: } # CHECK-NEXT: }
# PLT-SYM-NEXT: ] # CHECK-NEXT: ]
# #
# PLT-SYM: Name: T1@ (7) # CHECK: Symbol {
# PLT-SYM-NEXT: Value: 0x0 # CHECK: Name: T0@
# PLT-SYM-NEXT: Size: 0 # CHECK-NEXT: Value: 0x[[ADDR1]]
# PLT-SYM-NEXT: Binding: Global (0x1) # CHECK-NEXT: Size: 8
# PLT-SYM-NEXT: Type: None (0x0) # CHECK-NEXT: Binding: Global
# PLT-SYM-NEXT: Other: 0 # CHECK-NEXT: Type: Function
# PLT-SYM-NEXT: Section: Undefined (0x0) # CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .text
# CHECK-NEXT: }
# CHECK: Symbol {
# CHECK: Name: D0@
# CHECK-NEXT: Value: 0x[[ADDR2]]
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Object
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .data
# CHECK-NEXT: }
# CHECK: Symbol {
# CHECK: Name: T1@
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: None
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
!ELF FileHeader:
FileHeader: !FileHeader
Class: ELFCLASS32 Class: ELFCLASS32
Data: ELFDATA2LSB Data: ELFDATA2LSB
Type: ET_REL Type: ET_REL
@ -39,13 +58,13 @@ FileHeader: !FileHeader
Sections: Sections:
- Name: .text - Name: .text
Type: SHT_PROGBITS Type: SHT_PROGBITS
Content: "0000000000000000" Size: 8
AddressAlign: 16 AddressAlign: 16
Flags: [SHF_EXECINSTR, SHF_ALLOC] Flags: [SHF_EXECINSTR, SHF_ALLOC]
- Name: .data - Name: .data
Type: SHT_PROGBITS Type: SHT_PROGBITS
Content: "0000000000000000" Size: 8
AddressAlign: 16 AddressAlign: 16
Flags: [SHF_WRITE, SHF_ALLOC] Flags: [SHF_WRITE, SHF_ALLOC]
@ -54,7 +73,7 @@ Sections:
Info: .text Info: .text
AddressAlign: 4 AddressAlign: 4
Relocations: Relocations:
- Offset: 0x00 - Offset: 0
Symbol: T1 Symbol: T1
Type: R_MIPS_32 Type: R_MIPS_32
@ -63,7 +82,7 @@ Sections:
Info: .data Info: .data
AddressAlign: 4 AddressAlign: 4
Relocations: Relocations:
- Offset: 0x00 - Offset: 0
Symbol: T1 Symbol: T1
Type: R_MIPS_32 Type: R_MIPS_32
@ -72,11 +91,11 @@ Symbols:
- Name: T0 - Name: T0
Section: .text Section: .text
Type: STT_FUNC Type: STT_FUNC
Value: 0x0 Value: 0
Size: 4 Size: 4
- Name: T1 - Name: T1
- Name: D0 - Name: D0
Section: .data Section: .data
Type: STT_OBJECT Type: STT_OBJECT
Value: 0x0 Value: 0
Size: 8 Size: 8

View File

@ -8,48 +8,46 @@
# #
# RUN: yaml2obj -format=elf %s > %t.o # RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target mips64el -shared -o %t.so %t.o # RUN: lld -flavor gnu -target mips64el -shared -o %t.so %t.o
# RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=CHECK %s # RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s
# RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s # RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s
# CHECK: Sections [ # SYM: Sections [
# CHECK: Section { # SYM: Section {
# CHECK-NOT: Name: .plt ({{[0-9]+}}) # SYM-NOT: Name: .plt ({{[0-9]+}})
# CHECK: Relocations [ # SYM: Relocations [
# CHECK-NEXT: Section (4) .rel.dyn { # SYM-NEXT: Section (4) .rel.dyn {
# CHECK-NEXT: 0x170 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T0 0x0 # SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T0 0x0
# CHECK-NEXT: } # SYM-NEXT: }
# CHECK-NEXT: ] # SYM-NEXT: ]
# CHECK: DynamicSymbols [ # SYM: Symbol {
# CHECK-NEXT: Symbol { # SYM: Name: @ (0)
# CHECK-NEXT: Name: @ (0) # SYM-NEXT: Value: 0x0
# CHECK-NEXT: Value: 0x0 # SYM-NEXT: Size: 0
# CHECK-NEXT: Size: 0 # SYM-NEXT: Binding: Local (0x0)
# CHECK-NEXT: Binding: Local (0x0) # SYM-NEXT: Type: None (0x0)
# CHECK-NEXT: Type: None (0x0) # SYM-NEXT: Other: 0
# CHECK-NEXT: Other: 0 # SYM-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: Section: Undefined (0x0) # SYM-NEXT: }
# CHECK-NEXT: } # SYM: Symbol {
# CHECK-NEXT: Symbol { # SYM: Name: T1@ (4)
# CHECK-NEXT: Name: T1@ (4) # SYM-NEXT: Value: 0x174
# CHECK-NEXT: Value: 0x174 # SYM-NEXT: Size: 4
# CHECK-NEXT: Size: 4 # SYM-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Binding: Global (0x1) # SYM-NEXT: Type: Function (0x2)
# CHECK-NEXT: Type: Function (0x2) # SYM-NEXT: Other: 0
# CHECK-NEXT: Other: 0 # SYM-NEXT: Section: .text (0x5)
# CHECK-NEXT: Section: .text (0x5) # SYM-NEXT: }
# CHECK-NEXT: } # SYM: Symbol {
# CHECK-NEXT: Symbol { # SYM: Name: T0@ (1)
# CHECK-NEXT: Name: T0@ (1) # SYM-NEXT: Value: 0x[[ADDR]]
# CHECK-NEXT: Value: 0x170 # SYM-NEXT: Size: 4
# CHECK-NEXT: Size: 4 # SYM-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Binding: Global (0x1) # SYM-NEXT: Type: Function (0x2)
# CHECK-NEXT: Type: Function (0x2) # SYM-NEXT: Other: 0
# CHECK-NEXT: Other: 0 # SYM-NEXT: Section: .text (0x5)
# CHECK-NEXT: Section: .text (0x5) # SYM-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: ]
# GOT: Local entries [ # GOT: Local entries [
# GOT-NEXT: ] # GOT-NEXT: ]

View File

@ -6,50 +6,48 @@
# a) There should be no PLT entries. # a) There should be no PLT entries.
# b) Linker creates a single R_MIPS_REL32 relocation. # b) Linker creates a single R_MIPS_REL32 relocation.
# #
# RUN: yaml2obj -format=elf %s > %t-obj # RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t1-so %t-obj # RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t.o
# RUN: llvm-readobj -dt -r -s %t1-so | FileCheck -check-prefix=PLT1 %s # RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s
# RUN: llvm-readobj -mips-plt-got %t1-so | FileCheck -check-prefix=GOT %s # RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s
# PLT1-SYM: Sections [ # SYM: Sections [
# PLT1-SYM: Section { # SYM: Section {
# PLT1-SYM-NOT: Name: .plt ({{[0-9]+}}) # SYM-NOT: Name: .plt ({{[0-9]+}})
# PLT1: Relocations [ # SYM: Relocations [
# PLT1-NEXT: Section (4) .rel.dyn { # SYM-NEXT: Section (4) .rel.dyn {
# PLT1-NEXT: 0x100 R_MIPS_REL32 T0 0x0 # SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32 T0 0x0
# PLT1-NEXT: } # SYM-NEXT: }
# PLT1-NEXT: ] # SYM-NEXT: ]
# PLT1: DynamicSymbols [ # SYM: Symbol {
# PLT1-NEXT: Symbol { # SYM: Name: @ (0)
# PLT1-NEXT: Name: @ (0) # SYM-NEXT: Value: 0x0
# PLT1-NEXT: Value: 0x0 # SYM-NEXT: Size: 0
# PLT1-NEXT: Size: 0 # SYM-NEXT: Binding: Local (0x0)
# PLT1-NEXT: Binding: Local (0x0) # SYM-NEXT: Type: None (0x0)
# PLT1-NEXT: Type: None (0x0) # SYM-NEXT: Other: 0
# PLT1-NEXT: Other: 0 # SYM-NEXT: Section: Undefined (0x0)
# PLT1-NEXT: Section: Undefined (0x0) # SYM-NEXT: }
# PLT1-NEXT: } # SYM: Symbol {
# PLT1-NEXT: Symbol { # SYM: Name: T1@ (4)
# PLT1-NEXT: Name: T1@ (4) # SYM-NEXT: Value: 0x104
# PLT1-NEXT: Value: 0x104 # SYM-NEXT: Size: 4
# PLT1-NEXT: Size: 4 # SYM-NEXT: Binding: Global (0x1)
# PLT1-NEXT: Binding: Global (0x1) # SYM-NEXT: Type: Function (0x2)
# PLT1-NEXT: Type: Function (0x2) # SYM-NEXT: Other: 0
# PLT1-NEXT: Other: 0 # SYM-NEXT: Section: .text (0x5)
# PLT1-NEXT: Section: .text (0x5) # SYM-NEXT: }
# PLT1-NEXT: } # SYM: Symbol {
# PLT1-NEXT: Symbol { # SYM: Name: T0@ (1)
# PLT1-NEXT: Name: T0@ (1) # SYM-NEXT: Value: 0x[[ADDR]]
# PLT1-NEXT: Value: 0x100 # SYM-NEXT: Size: 4
# PLT1-NEXT: Size: 4 # SYM-NEXT: Binding: Global (0x1)
# PLT1-NEXT: Binding: Global (0x1) # SYM-NEXT: Type: Function (0x2)
# PLT1-NEXT: Type: Function (0x2) # SYM-NEXT: Other: 0
# PLT1-NEXT: Other: 0 # SYM-NEXT: Section: .text (0x5)
# PLT1-NEXT: Section: .text (0x5) # SYM-NEXT: }
# PLT1-NEXT: }
# PLT1-NEXT: ]
# GOT: Local entries [ # GOT: Local entries [
# GOT-NEXT: ] # GOT-NEXT: ]
@ -65,8 +63,7 @@
# GOT-NEXT: } # GOT-NEXT: }
# GOT-NEXT: ] # GOT-NEXT: ]
!ELF FileHeader:
FileHeader: !FileHeader
Class: ELFCLASS32 Class: ELFCLASS32
Data: ELFDATA2LSB Data: ELFDATA2LSB
Type: ET_REL Type: ET_REL
@ -76,7 +73,7 @@ FileHeader: !FileHeader
Sections: Sections:
- Name: .text - Name: .text
Type: SHT_PROGBITS Type: SHT_PROGBITS
Content: "0000000000000000" Size: 8
AddressAlign: 16 AddressAlign: 16
Flags: [SHF_EXECINSTR, SHF_ALLOC] Flags: [SHF_EXECINSTR, SHF_ALLOC]
@ -85,13 +82,13 @@ Sections:
Info: .text Info: .text
AddressAlign: 4 AddressAlign: 4
Relocations: Relocations:
- Offset: 0x00 - Offset: 0
Symbol: T0 Symbol: T0
Type: R_MIPS_32 Type: R_MIPS_32
- Name: .pdr - Name: .pdr
Type: SHT_PROGBITS Type: SHT_PROGBITS
Content: "0000000000000000" Size: 8
AddressAlign: 16 AddressAlign: 16
Flags: [] Flags: []
@ -100,7 +97,7 @@ Sections:
Info: .pdr Info: .pdr
AddressAlign: 4 AddressAlign: 4
Relocations: Relocations:
- Offset: 0x00 - Offset: 0
Symbol: T1 Symbol: T1
Type: R_MIPS_32 Type: R_MIPS_32
@ -109,10 +106,10 @@ Symbols:
- Name: T0 - Name: T0
Section: .text Section: .text
Type: STT_FUNC Type: STT_FUNC
Value: 0x0 Value: 0
Size: 4 Size: 4
- Name: T1 - Name: T1
Section: .text Section: .text
Type: STT_FUNC Type: STT_FUNC
Value: 0x4 Value: 4
Size: 4 Size: 4

View File

@ -2,11 +2,25 @@
# RUN: yaml2obj -format=elf %s > %t.o # RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target mips64el -e T0 -o %t.exe %t.o # RUN: lld -flavor gnu -target mips64el -e T0 -o %t.exe %t.o
# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=REL-EXE %s
# RUN: llvm-objdump -s %t.exe | FileCheck %s # RUN: llvm-objdump -s %t.exe | FileCheck %s
# RUN: llvm-nm %t.exe | FileCheck --check-prefix=SYM %s
# REL-EXE: Relocations [
# REL-EXE-NEXT: ]
# CHECK: Contents of section .text: # CHECK: Contents of section .text:
# CHECK-NEXT: 1200001a0 c871ffff ffffffff c871ffff c871ffff .q.......q...q.. # CHECK-NEXT: 1200001a0 c871ffff ffffffff c871ffff c871ffff
# CHECK-NEXT: 1200001b0 c871ffff ffffffff 00000000 00000000 .q.............. # CHECK-NEXT: 1200001b0 c871ffff ffffffff 00000000 00000000
# SYM: 00000001200001b8 T LT1
# SYM: 0000000120001000 ? _GLOBAL_OFFSET_TABLE_
# RUN: lld -flavor gnu -target mips64el -shared -o %t.so %t.o
# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL-SO %s
# REL-SO: Relocations [
# REL-SO-NEXT: ]
--- ---
FileHeader: FileHeader: