[Mips] Support SHT_MIPS_ABIFLAGS section type flag in the llvm-readobj,

obj2yaml and yaml2obj tools.

llvm-svn: 212908
This commit is contained in:
Simon Atanasyan 2014-07-13 15:28:54 +00:00
parent aae6739823
commit a3c42e92aa
16 changed files with 66 additions and 11 deletions

View File

@ -344,6 +344,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration(
case ELF::EM_MIPS:
ECase(SHT_MIPS_REGINFO)
ECase(SHT_MIPS_OPTIONS)
ECase(SHT_MIPS_ABIFLAGS)
default:
// Nothing to do.
break;

View File

@ -11,7 +11,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -12,7 +12,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -11,7 +11,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -11,7 +11,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -11,7 +11,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -12,7 +12,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -12,7 +12,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -17,7 +17,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -17,7 +17,7 @@
# CHECK-OBJ: Section {
# CHECK-OBJ: Index: 5
# CHECK-OBJ: Name: .MIPS.abiflags (12)
# CHECK-OBJ: Type: (0x7000002A)
# CHECK-OBJ: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ: Flags [ (0x2)
# CHECK-OBJ: SHF_ALLOC (0x2)
# CHECK-OBJ: ]

View File

@ -25,7 +25,7 @@
# CHECK-OBJ-ALL: Section {
# CHECK-OBJ-ALL: Index: 5
# CHECK-OBJ-ALL: Name: .MIPS.abiflags ({{[0-9]+}})
# CHECK-OBJ-ALL: Type: (0x7000002A)
# CHECK-OBJ-ALL: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-OBJ-ALL: Flags [ (0x2)
# CHECK-OBJ-ALL: SHF_ALLOC (0x2)
# CHECK-OBJ-ALL: ]

View File

@ -191,6 +191,7 @@ COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
ELF-MIPSEL: FileHeader:
ELF-MIPSEL-NEXT: Class: ELFCLASS32
ELF-MIPSEL-NEXT: Data: ELFDATA2LSB
ELF-MIPSEL-NEXT: OSABI: ELFOSABI_GNU
ELF-MIPSEL-NEXT: Type: ET_REL
ELF-MIPSEL-NEXT: Machine: EM_MIPS
ELF-MIPSEL-NEXT: Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
@ -206,7 +207,7 @@ ELF-MIPSEL-NEXT: Link: .symtab
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000004
ELF-MIPSEL-NEXT: Info: .text
ELF-MIPSEL-NEXT: Relocations:
ELF-MIPSEL-NEXT: - Offset: 0
ELF-MIPSEL-NEXT: - Offset: 0x0000000000000000
ELF-MIPSEL-NEXT: Symbol: _gp_disp
ELF-MIPSEL-NEXT: Type: R_MIPS_HI16
ELF-MIPSEL-NEXT: Addend: 0
@ -239,6 +240,10 @@ ELF-MIPSEL-NEXT: - Name: .bss
ELF-MIPSEL-NEXT: Type: SHT_NOBITS
ELF-MIPSEL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ]
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000004
ELF-MIPSEL-NEXT: Content: 48656C6C
ELF-MIPSEL-NEXT: - Name: .mdebug.abi32
ELF-MIPSEL-NEXT: Type: SHT_PROGBITS
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000001
ELF-MIPSEL-NEXT: Content: ''
ELF-MIPSEL-NEXT: - Name: .rodata.str1.1
ELF-MIPSEL-NEXT: Type: SHT_PROGBITS
@ -250,6 +255,11 @@ ELF-MIPSEL-NEXT: Type: SHT_MIPS_REGINFO
ELF-MIPSEL-NEXT: Flags: [ SHF_ALLOC ]
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000001
ELF-MIPSEL-NEXT: Content: '000000000000000000000000000000000000000000000000'
ELF-MIPSEL-NEXT: - Name: .MIPS.abiflags
ELF-MIPSEL-NEXT: Type: SHT_MIPS_ABIFLAGS
ELF-MIPSEL-NEXT: Flags: [ SHF_ALLOC ]
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000008
ELF-MIPSEL-NEXT: Content: '000020010101000100000000000000000100000000000000'
ELF-MIPSEL-NEXT: Symbols:
ELF-MIPSEL-NEXT: Local:
ELF-MIPSEL-NEXT: - Name: trivial.ll
@ -267,17 +277,27 @@ ELF-MIPSEL-NEXT: Section: .data
ELF-MIPSEL-NEXT: - Name: .bss
ELF-MIPSEL-NEXT: Type: STT_SECTION
ELF-MIPSEL-NEXT: Section: .bss
ELF-MIPSEL-NEXT: - Name: .mdebug.abi32
ELF-MIPSEL-NEXT: Type: STT_SECTION
ELF-MIPSEL-NEXT: Section: .mdebug.abi32
ELF-MIPSEL-NEXT: - Name: .rodata.str1.1
ELF-MIPSEL-NEXT: Type: STT_SECTION
ELF-MIPSEL-NEXT: Section: .rodata.str1.1
ELF-MIPSEL-NEXT: - Name: .reginfo
ELF-MIPSEL-NEXT: Type: STT_SECTION
ELF-MIPSEL-NEXT: Section: .reginfo
ELF-MIPSEL-NEXT: - Name: .MIPS.abiflags
ELF-MIPSEL-NEXT: Type: STT_SECTION
ELF-MIPSEL-NEXT: Section: .MIPS.abiflags
ELF-MIPSEL-NEXT: Global:
ELF-MIPSEL-NEXT: - Name: main
ELF-MIPSEL-NEXT: Type: STT_FUNC
ELF-MIPSEL-NEXT: Section: .text
ELF-MIPSEL-NEXT: Size: 0x000000000000004C
ELF-MIPSEL-NEXT: - Name: var
ELF-MIPSEL-NEXT: Type: STT_OBJECT
ELF-MIPSEL-NEXT: Section: .bss
ELF-MIPSEL-NEXT: Size: 0x0000000000000004
ELF-MIPSEL-NEXT: - Name: SomeOtherFunction
ELF-MIPSEL-NEXT: - Name: _gp_disp
ELF-MIPSEL-NEXT: - Name: puts

Binary file not shown.

View File

@ -2,6 +2,8 @@ RUN: llvm-readobj -s %p/Inputs/trivial.obj.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF
RUN: llvm-readobj -s %p/Inputs/trivial.obj.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF
RUN: llvm-readobj -s %p/Inputs/trivial.obj.elf-mipsel \
RUN: | FileCheck %s -check-prefix ELF-MIPSEL
RUN: llvm-readobj -s %p/Inputs/trivial.obj.macho-i386 \
RUN: | FileCheck %s -check-prefix MACHO-I386
RUN: llvm-readobj -s %p/Inputs/trivial.obj.macho-x86-64 \
@ -84,6 +86,37 @@ ELF-NEXT: AddressAlignment: 16
ELF-NEXT: EntrySize: 0
ELF-NEXT: }
ELF-MIPSEL: Section {
ELF-MIPSEL: Index: 4
ELF-MIPSEL-NEXT: Name: .reginfo (27)
ELF-MIPSEL-NEXT: Type: SHT_MIPS_REGINFO (0x70000006)
ELF-MIPSEL-NEXT: Flags [ (0x2)
ELF-MIPSEL-NEXT: SHF_ALLOC (0x2)
ELF-MIPSEL-NEXT: ]
ELF-MIPSEL-NEXT: Address: 0x0
ELF-MIPSEL-NEXT: Offset: 0x34
ELF-MIPSEL-NEXT: Size: 24
ELF-MIPSEL-NEXT: Link: 0
ELF-MIPSEL-NEXT: Info: 0
ELF-MIPSEL-NEXT: AddressAlignment: 1
ELF-MIPSEL-NEXT: EntrySize: 0
ELF-MIPSEL-NEXT: }
ELF-MIPSEL-NEXT: Section {
ELF-MIPSEL-NEXT: Index: 5
ELF-MIPSEL-NEXT: Name: .MIPS.abiflags (12)
ELF-MIPSEL-NEXT: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
ELF-MIPSEL-NEXT: Flags [ (0x2)
ELF-MIPSEL-NEXT: SHF_ALLOC (0x2)
ELF-MIPSEL-NEXT: ]
ELF-MIPSEL-NEXT: Address: 0x0
ELF-MIPSEL-NEXT: Offset: 0x50
ELF-MIPSEL-NEXT: Size: 24
ELF-MIPSEL-NEXT: Link: 0
ELF-MIPSEL-NEXT: Info: 0
ELF-MIPSEL-NEXT: AddressAlignment: 8
ELF-MIPSEL-NEXT: EntrySize: 0
ELF-MIPSEL-NEXT: }
MACHO-I386: Sections [
MACHO-I386-NEXT: Section {
MACHO-I386-NEXT: Index: 0

View File

@ -407,6 +407,7 @@ static const char *getElfSectionType(unsigned Arch, unsigned Type) {
switch (Type) {
LLVM_READOBJ_ENUM_CASE(ELF, SHT_MIPS_REGINFO);
LLVM_READOBJ_ENUM_CASE(ELF, SHT_MIPS_OPTIONS);
LLVM_READOBJ_ENUM_CASE(ELF, SHT_MIPS_ABIFLAGS);
}
}