From 6a943fb16a41852df0d840d5ce65c0497d46c93c Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Tue, 21 Aug 2018 15:47:25 +0000 Subject: [PATCH] [aarch64][mc] Don't lookup symbols when there is no symbol lookup callback Summary: When run under llvm-mc-disassemble-fuzzer, there is no symbol lookup callback so tryAddingSymbolicOperand() must fail gracefully instead of crashing Reviewers: aemerson, javed.absar Reviewed By: aemerson Subscribers: lhames, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D51005 llvm-svn: 340287 --- .../Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp b/llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp index 6e64fc9347b9..4e9b75eeb4ff 100644 --- a/llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp +++ b/llvm/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp @@ -60,6 +60,8 @@ getVariant(uint64_t LLVMDisassembler_VariantKind) { bool AArch64ExternalSymbolizer::tryAddingSymbolicOperand( MCInst &MI, raw_ostream &CommentStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t InstSize) { + if (!SymbolLookUp) + return false; // FIXME: This method shares a lot of code with // MCExternalSymbolizer::tryAddingSymbolicOperand. It may be possible // refactor the MCExternalSymbolizer interface to allow more of this