From 51a9b19ed51fcda197167eefd628876d32cc3db1 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh <aquynh@gmail.com> Date: Tue, 31 May 2016 09:46:07 +0800 Subject: [PATCH] systemz: fix crash-11-systemz-elfobjectwriter-should-not-have-constructed-this.c --- llvm/lib/MC/MCAssembler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index da7f9b3..7a8407c 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -593,6 +593,13 @@ std::pair<uint64_t, bool> MCAssembler::handleFixup(const MCAsmLayout &Layout, // The fixup was unresolved, we need a relocation. Inform the object // writer of the relocation, and give it an opportunity to adjust the // fixup value if need be. + if (const MCSymbolRefExpr *RefB = Target.getSymB()) { + if (RefB->getKind() != MCSymbolRefExpr::VK_None) { + KsError = KS_ERR_ASM_FIXUP_INVALID; + // return a dummy value + return std::make_pair(0, false); + } + } getWriter().recordRelocation(*this, Layout, &F, Fixup, Target, IsPCRel, FixedValue); } -- GitLab