[PATCH] D77841: [RISCV] Consume error from parsing attributes section

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 17:39:33 PDT 2020


jrtc27 created this revision.
jrtc27 added reviewers: asb, jhenderson, MaskRay, HsiangKai.
Herald added subscribers: llvm-commits, danielkiss, evandro, luismarques, sameer.abuasal, s.egerton, lenary, Jim, benna, psnobl, rkruppe, rogfer01, shiva0217, kito-cheng, simoncook, hiraditya, kristof.beyls.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77841

Files:
  llvm/lib/Object/ELFObjectFile.cpp


Index: llvm/lib/Object/ELFObjectFile.cpp
===================================================================
--- llvm/lib/Object/ELFObjectFile.cpp
+++ llvm/lib/Object/ELFObjectFile.cpp
@@ -297,8 +297,11 @@
   // 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<StringRef> Attr = Attributes.getAttributeString(RISCVAttrs::ARCH);
   if (Attr.hasValue()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77841.256453.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200410/19e6b41e/attachment.bin>


More information about the llvm-commits mailing list