mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[ELF][Mips] Fix recognition of MIPS 64-bit arch in the ELFObjectFile:getArch() method.
llvm-svn: 211891
This commit is contained in:
parent
127f1b532c
commit
fb5fe85156
@ -917,6 +917,7 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
|
|||||||
|
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
unsigned ELFObjectFile<ELFT>::getArch() const {
|
unsigned ELFObjectFile<ELFT>::getArch() const {
|
||||||
|
bool IsLittleEndian = ELFT::TargetEndianness == support::little;
|
||||||
switch (EF.getHeader()->e_machine) {
|
switch (EF.getHeader()->e_machine) {
|
||||||
case ELF::EM_386:
|
case ELF::EM_386:
|
||||||
return Triple::x86;
|
return Triple::x86;
|
||||||
@ -929,11 +930,16 @@ unsigned ELFObjectFile<ELFT>::getArch() const {
|
|||||||
case ELF::EM_HEXAGON:
|
case ELF::EM_HEXAGON:
|
||||||
return Triple::hexagon;
|
return Triple::hexagon;
|
||||||
case ELF::EM_MIPS:
|
case ELF::EM_MIPS:
|
||||||
return (ELFT::TargetEndianness == support::little) ? Triple::mipsel
|
switch (EF.getHeader()->e_ident[ELF::EI_CLASS]) {
|
||||||
: Triple::mips;
|
case ELF::ELFCLASS32:
|
||||||
|
return IsLittleEndian ? Triple::mipsel : Triple::mips;
|
||||||
|
case ELF::ELFCLASS64:
|
||||||
|
return IsLittleEndian ? Triple::mips64el : Triple::mips64;
|
||||||
|
default:
|
||||||
|
report_fatal_error("Invalid ELFCLASS!");
|
||||||
|
}
|
||||||
case ELF::EM_PPC64:
|
case ELF::EM_PPC64:
|
||||||
return (ELFT::TargetEndianness == support::little) ? Triple::ppc64le
|
return IsLittleEndian ? Triple::ppc64le : Triple::ppc64;
|
||||||
: Triple::ppc64;
|
|
||||||
case ELF::EM_S390:
|
case ELF::EM_S390:
|
||||||
return Triple::systemz;
|
return Triple::systemz;
|
||||||
|
|
||||||
|
BIN
test/Object/Inputs/program-headers.mips64
Normal file
BIN
test/Object/Inputs/program-headers.mips64
Normal file
Binary file not shown.
@ -4,6 +4,8 @@ RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.elf-x8
|
|||||||
RUN: | FileCheck %s -check-prefix ELF-X86-64
|
RUN: | FileCheck %s -check-prefix ELF-X86-64
|
||||||
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.mips \
|
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.mips \
|
||||||
RUN: | FileCheck %s -check-prefix ELF-MIPS
|
RUN: | FileCheck %s -check-prefix ELF-MIPS
|
||||||
|
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.mips64 \
|
||||||
|
RUN: | FileCheck %s -check-prefix ELF-MIPS64
|
||||||
|
|
||||||
ELF-I386: ProgramHeaders [
|
ELF-I386: ProgramHeaders [
|
||||||
ELF-I386-NEXT: ProgramHeader {
|
ELF-I386-NEXT: ProgramHeader {
|
||||||
@ -75,7 +77,11 @@ ELF-X86-64-NEXT: Alignment: 8
|
|||||||
ELF-X86-64-NEXT: }
|
ELF-X86-64-NEXT: }
|
||||||
ELF-X86-64-NEXT: ]
|
ELF-X86-64-NEXT: ]
|
||||||
|
|
||||||
ELF-MIPS: ProgramHeaders [
|
ELF-MIPS: Format: ELF32-mips
|
||||||
|
ELF-MIPS-NEXT: Arch: mips
|
||||||
|
ELF-MIPS-NEXT: AddressSize: 32bit
|
||||||
|
ELF-MIPS-NEXT: LoadName:
|
||||||
|
ELF-MIPS-NEXT: ProgramHeaders [
|
||||||
ELF-MIPS-NEXT: ProgramHeader {
|
ELF-MIPS-NEXT: ProgramHeader {
|
||||||
ELF-MIPS-NEXT: Type: PT_MIPS_REGINFO (0x70000000)
|
ELF-MIPS-NEXT: Type: PT_MIPS_REGINFO (0x70000000)
|
||||||
ELF-MIPS-NEXT: Offset: 0x74
|
ELF-MIPS-NEXT: Offset: 0x74
|
||||||
@ -102,3 +108,23 @@ ELF-MIPS-NEXT: ]
|
|||||||
ELF-MIPS-NEXT: Alignment: 65536
|
ELF-MIPS-NEXT: Alignment: 65536
|
||||||
ELF-MIPS-NEXT: }
|
ELF-MIPS-NEXT: }
|
||||||
ELF-MIPS-NEXT: ]
|
ELF-MIPS-NEXT: ]
|
||||||
|
|
||||||
|
ELF-MIPS64: Format: ELF64-mips
|
||||||
|
ELF-MIPS64-NEXT: Arch: mips64
|
||||||
|
ELF-MIPS64-NEXT: AddressSize: 64bit
|
||||||
|
ELF-MIPS64-NEXT: LoadName:
|
||||||
|
ELF-MIPS64-NEXT: ProgramHeaders [
|
||||||
|
ELF-MIPS64-NEXT: ProgramHeader {
|
||||||
|
ELF-MIPS64-NEXT: Type: PT_LOAD (0x1)
|
||||||
|
ELF-MIPS64-NEXT: Offset: 0x0
|
||||||
|
ELF-MIPS64-NEXT: VirtualAddress: 0x120000000
|
||||||
|
ELF-MIPS64-NEXT: PhysicalAddress: 0x120000000
|
||||||
|
ELF-MIPS64-NEXT: FileSize: 136
|
||||||
|
ELF-MIPS64-NEXT: MemSize: 136
|
||||||
|
ELF-MIPS64-NEXT: Flags [ (0x5)
|
||||||
|
ELF-MIPS64-NEXT: PF_R (0x4)
|
||||||
|
ELF-MIPS64-NEXT: PF_X (0x1)
|
||||||
|
ELF-MIPS64-NEXT: ]
|
||||||
|
ELF-MIPS64-NEXT: Alignment: 65536
|
||||||
|
ELF-MIPS64-NEXT: }
|
||||||
|
ELF-MIPS64-NEXT: ]
|
||||||
|
Loading…
Reference in New Issue
Block a user