From: NAKAMURA Takumi Date: Sat, 26 Jan 2013 08:27:36 +0000 (+0000) Subject: Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a44b1c2486ef2f4d06dd3ee2daf031797e12718b;p=platform%2Fupstream%2Fllvm.git Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips. It fixes llvm-dwarfdump for mips and mipsel. llvm-svn: 173567 --- diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 136fdf5..1e84831 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -2345,6 +2345,8 @@ StringRef ELFObjectFile::getFileFormatName() const { return "ELF32-arm"; case ELF::EM_HEXAGON: return "ELF32-hexagon"; + case ELF::EM_MIPS: + return "ELF32-mips"; default: return "ELF32-unknown"; } diff --git a/llvm/include/llvm/Object/RelocVisitor.h b/llvm/include/llvm/Object/RelocVisitor.h index d17610a..edac899 100644 --- a/llvm/include/llvm/Object/RelocVisitor.h +++ b/llvm/include/llvm/Object/RelocVisitor.h @@ -84,6 +84,14 @@ public: HasError = true; return RelocToApply(); } + } else if (FileFormat == "ELF32-mips") { + switch (RelocType) { + case llvm::ELF::R_MIPS_32: + return visitELF_MIPS_32(R, Value); + default: + HasError = true; + return RelocToApply(); + } } HasError = true; return RelocToApply(); @@ -156,6 +164,14 @@ private: uint32_t Res = (Value + Addend) & 0xFFFFFFFF; return RelocToApply(Res, 4); } + + /// MIPS ELF + RelocToApply visitELF_MIPS_32(RelocationRef R, uint64_t Value) { + int64_t Addend; + R.getAdditionalInfo(Addend); + uint32_t Res = (Value + Addend) & 0xFFFFFFFF; + return RelocToApply(Res, 4); + } }; }