Object/RelocVisitor: Add minimal support, R_PPC64_ADDR32, for ppc64.

It fixes llvm-dwarfdump for ppc64-elf.

llvm-svn: 173566
This commit is contained in:
NAKAMURA Takumi 2013-01-26 08:27:29 +00:00
parent a5b09ff6b9
commit 3ba23555de
1 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,14 @@ public:
HasError = true; HasError = true;
return RelocToApply(); return RelocToApply();
} }
} else if (FileFormat == "ELF64-ppc64") {
switch (RelocType) {
case llvm::ELF::R_PPC64_ADDR32:
return visitELF_PPC64_ADDR32(R, Value);
default:
HasError = true;
return RelocToApply();
}
} }
HasError = true; HasError = true;
return RelocToApply(); return RelocToApply();
@ -140,6 +148,14 @@ private:
int32_t Res = (Value + Addend) & 0xFFFFFFFF; int32_t Res = (Value + Addend) & 0xFFFFFFFF;
return RelocToApply(Res, 4); return RelocToApply(Res, 4);
} }
/// PPC64 ELF
RelocToApply visitELF_PPC64_ADDR32(RelocationRef R, uint64_t Value) {
int64_t Addend;
R.getAdditionalInfo(Addend);
uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
return RelocToApply(Res, 4);
}
}; };
} }