From 49e20c4c9efe1c0e74f9c0dc224a8014b93faa3c Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 10 Apr 2020 01:30:48 +0100 Subject: [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 --- llvm/lib/Object/ELFObjectFile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/ELFObjectFile.cpp') 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()) { -- cgit v1.1