Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[objdump][macho] Check arch before formating reloc name as arm64 addend
Before formating ARM64_RELOC_ADDEND relocation target name as a hex
number, the architecture need to be checked since other architectures
can define a different relocation type with the same integer as
ARM64_RELOC_ADDEND.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D89094
  • Loading branch information
pguo-cn authored and dsandersllvm committed Oct 16, 2020
1 parent f16cecf commit 1091130
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/tools/llvm-objdump/MachODump.cpp
Expand Up @@ -453,7 +453,8 @@ static void printRelocationTargetName(const MachOObjectFile *O,
bool isExtern = O->getPlainRelocationExternal(RE);
uint64_t Val = O->getPlainRelocationSymbolNum(RE);

if (O->getAnyRelocationType(RE) == MachO::ARM64_RELOC_ADDEND) {
if (O->getAnyRelocationType(RE) == MachO::ARM64_RELOC_ADDEND &&
(O->getArch() == Triple::aarch64 || O->getArch() == Triple::aarch64_be)) {
Fmt << format("0x%0" PRIx64, Val);
return;
}
Expand Down

0 comments on commit 1091130

Please sign in to comment.