diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-18 16:00:35 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-18 16:00:35 +0000 |
| commit | 488798094bb701528a072bf05f16ab947a770880 (patch) | |
| tree | f4b179116e413ec4bdeff383782a27ffb280c627 | |
| parent | 2f474f0e8a53145f585cf040968bde09e13c613d (diff) | |
| download | bcm5719-llvm-488798094bb701528a072bf05f16ab947a770880.tar.gz bcm5719-llvm-488798094bb701528a072bf05f16ab947a770880.zip | |
Add basic support for ELF32-ppc relocations to llvm-dwarfdump.
Should help the ppc32 buildbot.
llvm-svn: 182194
| -rw-r--r-- | llvm/include/llvm/Object/ELF.h | 2 | ||||
| -rw-r--r-- | llvm/include/llvm/Object/RelocVisitor.h | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 22ca201be12..5a26decd95e 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -2697,6 +2697,8 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const { return "ELF32-hexagon"; case ELF::EM_MIPS: return "ELF32-mips"; + case ELF::EM_PPC: + return "ELF32-ppc"; default: return "ELF32-unknown"; } diff --git a/llvm/include/llvm/Object/RelocVisitor.h b/llvm/include/llvm/Object/RelocVisitor.h index 69ce5cffc3c..52e4d6f98f1 100644 --- a/llvm/include/llvm/Object/RelocVisitor.h +++ b/llvm/include/llvm/Object/RelocVisitor.h @@ -85,6 +85,14 @@ public: HasError = true; return RelocToApply(); } + } else if (FileFormat == "ELF32-ppc") { + switch (RelocType) { + case llvm::ELF::R_PPC_ADDR32: + return visitELF_PPC_ADDR32(R, Value); + default: + HasError = true; + return RelocToApply(); + } } else if (FileFormat == "ELF32-mips") { switch (RelocType) { case llvm::ELF::R_MIPS_32: @@ -210,6 +218,13 @@ private: return RelocToApply(Res, 4); } + /// PPC32 ELF + RelocToApply visitELF_PPC_ADDR32(RelocationRef R, uint64_t Value) { + int64_t Addend = getAddend32BE(R); + uint32_t Res = (Value + Addend) & 0xFFFFFFFF; + return RelocToApply(Res, 4); + } + /// MIPS ELF RelocToApply visitELF_MIPS_32(RelocationRef R, uint64_t Value) { int64_t Addend; |

