diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2014-06-27 11:36:45 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2014-06-27 11:36:45 +0000 |
commit | fc9897f66f40ec2b079cb2d697bd41db7db2f3ed (patch) | |
tree | 70b67a9c9092020b63dd006a20c00a0335ed5393 /include | |
parent | 4363b0729b2b2aa50949ac9fb3af5ced0240898f (diff) | |
download | llvm-fc9897f66f40ec2b079cb2d697bd41db7db2f3ed.tar.gz llvm-fc9897f66f40ec2b079cb2d697bd41db7db2f3ed.tar.bz2 llvm-fc9897f66f40ec2b079cb2d697bd41db7db2f3ed.tar.xz |
[ELF][Mips] Fix recognition of MIPS 64-bit arch in the ELFObjectFile:getArch() method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Object/ELFObjectFile.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h index ae74ebc02c..deff409c5d 100644 --- a/include/llvm/Object/ELFObjectFile.h +++ b/include/llvm/Object/ELFObjectFile.h @@ -917,6 +917,7 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const { template <class ELFT> unsigned ELFObjectFile<ELFT>::getArch() const { + bool IsLittleEndian = ELFT::TargetEndianness == support::little; switch (EF.getHeader()->e_machine) { case ELF::EM_386: return Triple::x86; @@ -929,11 +930,16 @@ unsigned ELFObjectFile<ELFT>::getArch() const { case ELF::EM_HEXAGON: return Triple::hexagon; case ELF::EM_MIPS: - return (ELFT::TargetEndianness == support::little) ? Triple::mipsel - : Triple::mips; + switch (EF.getHeader()->e_ident[ELF::EI_CLASS]) { + 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: - return (ELFT::TargetEndianness == support::little) ? Triple::ppc64le - : Triple::ppc64; + return IsLittleEndian ? Triple::ppc64le : Triple::ppc64; case ELF::EM_S390: return Triple::systemz; |