[llvm] 1091130 - [objdump][macho] Check arch before formating reloc name as arm64 addend
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 14:31:00 PDT 2020
Author: Peng Guo
Date: 2020-10-16T14:30:22-07:00
New Revision: 109113015ebeeceec862fc53a678b3619a879ce4
URL: https://github.com/llvm/llvm-project/commit/109113015ebeeceec862fc53a678b3619a879ce4
DIFF: https://github.com/llvm/llvm-project/commit/109113015ebeeceec862fc53a678b3619a879ce4.diff
LOG: [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
Added:
Modified:
llvm/tools/llvm-objdump/MachODump.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 22096c224714..7103f6d6e0f8 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -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;
}
More information about the llvm-commits
mailing list