Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips.

It fixes llvm-dwarfdump for mips and mipsel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173567 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2013-01-26 08:27:36 +00:00
parent 994754feea
commit 3802947dec
2 changed files with 18 additions and 0 deletions

View File

@ -2345,6 +2345,8 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
return "ELF32-arm";
case ELF::EM_HEXAGON:
return "ELF32-hexagon";
case ELF::EM_MIPS:
return "ELF32-mips";
default:
return "ELF32-unknown";
}

View File

@ -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);
}
};
}