Skip to content

Commit 1091130

Browse files
pguo-cndsandersllvm
authored andcommitted
[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
1 parent f16cecf commit 1091130

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/tools/llvm-objdump/MachODump.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ static void printRelocationTargetName(const MachOObjectFile *O,
453453
bool isExtern = O->getPlainRelocationExternal(RE);
454454
uint64_t Val = O->getPlainRelocationSymbolNum(RE);
455455

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

0 commit comments

Comments
 (0)