From b69e16b5cce6987dd9da3570c1b97e4b7e437d85 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 6 Jun 2021 15:33:28 +0100 Subject: [PATCH] X86MachObjectWriter.cpp - silence null deference warnings. NFCI. The MCSymbol data should always be present for non-absolute sections so assert that it is to silence static analysis warnings. --- llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp index b98e58d..dff9b31 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp @@ -537,6 +537,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer, uint32_t Offset = Target.getConstant(); if (IsPCRel) Offset += 1 << Log2Size; + // Try to record the scattered relocation if needed. Fall back to non // scattered if necessary (see comments in recordScatteredRelocation() // for details). @@ -558,6 +559,8 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer, // find a case where they are actually emitted. Type = MachO::GENERIC_RELOC_VANILLA; } else { + assert(A && "Unknown symbol data"); + // Resolve constant variables. if (A->isVariable()) { int64_t Res; -- 2.7.4