diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-01-29 18:27:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2018-01-29 18:27:30 +0000 |
commit | d5f76ad37fb235c684d551251eb8c0e204bde134 (patch) | |
tree | 2881a388648aff9c643e4ede88c0d0ee27f92702 /llvm/lib | |
parent | c061175fcde7b0a4b3cc3ced233164b714e961f4 (diff) | |
download | bcm5719-llvm-d5f76ad37fb235c684d551251eb8c0e204bde134.tar.gz bcm5719-llvm-d5f76ad37fb235c684d551251eb8c0e204bde134.zip |
Move getPlatformFlags to ELFObjectFileBase and simplify.
This removes a few std::error_code results that were ignored on every
call.
llvm-svn: 323674
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 3 |
2 files changed, 9 insertions, 12 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index 7f3f50e418c..36b43ec9b78 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -529,10 +529,11 @@ void RuntimeDyldELF::setMipsABI(const ObjectFile &Obj) { IsMipsN64ABI = false; return; } - unsigned AbiVariant; - Obj.getPlatformFlags(AbiVariant); - IsMipsO32ABI = AbiVariant & ELF::EF_MIPS_ABI_O32; - IsMipsN32ABI = AbiVariant & ELF::EF_MIPS_ABI2; + if (auto *E = dyn_cast<ELFObjectFileBase>(&Obj)) { + unsigned AbiVariant = E->getPlatformFlags(); + IsMipsO32ABI = AbiVariant & ELF::EF_MIPS_ABI_O32; + IsMipsN32ABI = AbiVariant & ELF::EF_MIPS_ABI2; + } IsMipsN64ABI = Obj.getFileFormatName().equals("ELF64-mips"); } @@ -1261,8 +1262,7 @@ RuntimeDyldELF::processRelocationRef( DEBUG(dbgs() << " Create a new stub function\n"); Stubs[Value] = Section.getStubOffset(); - unsigned AbiVariant; - O.getPlatformFlags(AbiVariant); + unsigned AbiVariant = Obj.getPlatformFlags(); uint8_t *StubTargetAddr = createStubFunction( Section.getAddressWithOffset(Section.getStubOffset()), AbiVariant); @@ -1357,8 +1357,7 @@ RuntimeDyldELF::processRelocationRef( DEBUG(dbgs() << " Create a new stub function\n"); Stubs[Value] = Section.getStubOffset(); - unsigned AbiVariant; - O.getPlatformFlags(AbiVariant); + unsigned AbiVariant = Obj.getPlatformFlags(); uint8_t *StubTargetAddr = createStubFunction( Section.getAddressWithOffset(Section.getStubOffset()), AbiVariant); @@ -1415,8 +1414,7 @@ RuntimeDyldELF::processRelocationRef( } else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le) { if (RelType == ELF::R_PPC64_REL24) { // Determine ABI variant in use for this object. - unsigned AbiVariant; - Obj.getPlatformFlags(AbiVariant); + unsigned AbiVariant = Obj.getPlatformFlags(); AbiVariant &= ELF::EF_PPC64_ABI; // A PPC branch relocation will need a stub function if the target is // an external symbol (either Value.SymbolName is set, or SymType is diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 0aad1c89a2d..3c1bdf5a1de 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -76,8 +76,7 @@ ObjectFile::createELFObjectFile(MemoryBufferRef Obj) { SubtargetFeatures ELFObjectFileBase::getMIPSFeatures() const { SubtargetFeatures Features; - unsigned PlatformFlags; - getPlatformFlags(PlatformFlags); + unsigned PlatformFlags = getPlatformFlags(); switch (PlatformFlags & ELF::EF_MIPS_ARCH) { case ELF::EF_MIPS_ARCH_1: |