From: Jessica Clarke Date: Fri, 10 Apr 2020 00:30:48 +0000 (+0100) Subject: [RISCV] Consume error from parsing attributes section X-Git-Tag: llvmorg-12-init~9431 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49e20c4c9efe1c0e74f9c0dc224a8014b93faa3c;p=platform%2Fupstream%2Fllvm.git [RISCV] Consume error from parsing attributes section Summary: We don't consume the error from getBuildAttributes, so an assertions build crashes with "Program aborted due to an unhandled Error:". Explicitly consume it like the ARM version in that case. Reviewers: asb, jhenderson, MaskRay, HsiangKai Reviewed By: MaskRay Subscribers: kristof.beyls, hiraditya, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, psnobl, benna, Jim, lenary, s.egerton, sameer.abuasal, luismarques, evandro, danielkiss, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77841 --- diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 8627d1b..c919d25 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -297,8 +297,11 @@ SubtargetFeatures ELFObjectFileBase::getRISCVFeatures() const { // Add features according to the ELF attribute section. // If there are any unrecognized features, ignore them. RISCVAttributeParser Attributes; - if (Error E = getBuildAttributes(Attributes)) + if (Error E = getBuildAttributes(Attributes)) { + // TODO Propagate Error. + consumeError(std::move(E)); return Features; // Keep "c" feature if there is one in PlatformFlags. + } Optional Attr = Attributes.getAttributeString(RISCVAttrs::ARCH); if (Attr.hasValue()) {