Skip to content

Commit

Permalink
[Mips] Support SHT_MIPS_ABIFLAGS section type flag in the llvm-readobj,
Browse files Browse the repository at this point in the history
obj2yaml and yaml2obj tools.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212908 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
atanasyan committed Jul 13, 2014
1 parent d74d9b3 commit b2b56ed
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/Object/ELFYAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/mips32/abiflags.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/mips32r2/abiflags.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/mips64/abiflags.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/mips64r2/abiflags.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/mips_abi_flags_xx.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/mips_abi_flags_xx_set.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/msa/abiflags.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/nooddspreg-cmdarg.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/nooddspreg.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
2 changes: 1 addition & 1 deletion test/MC/Mips/oddspreg.s
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand Down
Binary file modified test/Object/Inputs/trivial-object-test.elf-mipsel
Binary file not shown.
22 changes: 21 additions & 1 deletion test/Object/obj2yaml.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Binary file not shown.
33 changes: 33 additions & 0 deletions test/tools/llvm-readobj/sections.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tools/llvm-readobj/ELFDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit b2b56ed

Please sign in to comment.