diff --git a/lib/Object/ELFYAML.cpp b/lib/Object/ELFYAML.cpp index a2fb440beaf..588bf7a5d32 100644 --- a/lib/Object/ELFYAML.cpp +++ b/lib/Object/ELFYAML.cpp @@ -344,6 +344,7 @@ void ScalarEnumerationTraits::enumeration( case ELF::EM_MIPS: ECase(SHT_MIPS_REGINFO) ECase(SHT_MIPS_OPTIONS) + ECase(SHT_MIPS_ABIFLAGS) default: // Nothing to do. break; diff --git a/test/MC/Mips/mips32/abiflags.s b/test/MC/Mips/mips32/abiflags.s index 896dd84261c..021ff793cea 100644 --- a/test/MC/Mips/mips32/abiflags.s +++ b/test/MC/Mips/mips32/abiflags.s @@ -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: ] diff --git a/test/MC/Mips/mips32r2/abiflags.s b/test/MC/Mips/mips32r2/abiflags.s index 41a809a857e..1904117ef66 100644 --- a/test/MC/Mips/mips32r2/abiflags.s +++ b/test/MC/Mips/mips32r2/abiflags.s @@ -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: ] diff --git a/test/MC/Mips/mips64/abiflags.s b/test/MC/Mips/mips64/abiflags.s index 557e32a8ece..b41d914f1b2 100644 --- a/test/MC/Mips/mips64/abiflags.s +++ b/test/MC/Mips/mips64/abiflags.s @@ -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: ] diff --git a/test/MC/Mips/mips64r2/abiflags.s b/test/MC/Mips/mips64r2/abiflags.s index aa76deeb1f9..b76a4b4720d 100644 --- a/test/MC/Mips/mips64r2/abiflags.s +++ b/test/MC/Mips/mips64r2/abiflags.s @@ -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: ] diff --git a/test/MC/Mips/mips_abi_flags_xx.s b/test/MC/Mips/mips_abi_flags_xx.s index 1d65e99a4c5..47d90841d86 100644 --- a/test/MC/Mips/mips_abi_flags_xx.s +++ b/test/MC/Mips/mips_abi_flags_xx.s @@ -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: ] diff --git a/test/MC/Mips/mips_abi_flags_xx_set.s b/test/MC/Mips/mips_abi_flags_xx_set.s index 56f19d308f7..9694b9de5a5 100644 --- a/test/MC/Mips/mips_abi_flags_xx_set.s +++ b/test/MC/Mips/mips_abi_flags_xx_set.s @@ -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: ] diff --git a/test/MC/Mips/msa/abiflags.s b/test/MC/Mips/msa/abiflags.s index 83b83cc0df3..3b13870f8d4 100644 --- a/test/MC/Mips/msa/abiflags.s +++ b/test/MC/Mips/msa/abiflags.s @@ -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: ] diff --git a/test/MC/Mips/nooddspreg-cmdarg.s b/test/MC/Mips/nooddspreg-cmdarg.s index 826db1236a9..993c630c13a 100644 --- a/test/MC/Mips/nooddspreg-cmdarg.s +++ b/test/MC/Mips/nooddspreg-cmdarg.s @@ -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: ] diff --git a/test/MC/Mips/nooddspreg.s b/test/MC/Mips/nooddspreg.s index 5a283f54f7e..10cd1ac068f 100644 --- a/test/MC/Mips/nooddspreg.s +++ b/test/MC/Mips/nooddspreg.s @@ -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: ] diff --git a/test/MC/Mips/oddspreg.s b/test/MC/Mips/oddspreg.s index f5aa9c00db0..39155f2b059 100644 --- a/test/MC/Mips/oddspreg.s +++ b/test/MC/Mips/oddspreg.s @@ -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: ] diff --git a/test/Object/Inputs/trivial-object-test.elf-mipsel b/test/Object/Inputs/trivial-object-test.elf-mipsel index 2910a16b8ef..e72e02b9b25 100644 Binary files a/test/Object/Inputs/trivial-object-test.elf-mipsel and b/test/Object/Inputs/trivial-object-test.elf-mipsel differ diff --git a/test/Object/obj2yaml.test b/test/Object/obj2yaml.test index c986b91281e..1c79e98fdc3 100644 --- a/test/Object/obj2yaml.test +++ b/test/Object/obj2yaml.test @@ -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 diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.elf-mipsel b/test/tools/llvm-readobj/Inputs/trivial.obj.elf-mipsel new file mode 100644 index 00000000000..c523908605c Binary files /dev/null and b/test/tools/llvm-readobj/Inputs/trivial.obj.elf-mipsel differ diff --git a/test/tools/llvm-readobj/sections.test b/test/tools/llvm-readobj/sections.test index 16f1131e05b..fe734d77e34 100644 --- a/test/tools/llvm-readobj/sections.test +++ b/test/tools/llvm-readobj/sections.test @@ -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 diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp index 5df51e250d2..1791f5a3247 100644 --- a/tools/llvm-readobj/ELFDumper.cpp +++ b/tools/llvm-readobj/ELFDumper.cpp @@ -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); } }