[PATCH] D154146: [BOLT] Exit on parseLSDA errors

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 13:23:18 PDT 2023


Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Replace assertions with checking and error reporting.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154146

Files:
  bolt/lib/Core/Exceptions.cpp


Index: bolt/lib/Core/Exceptions.cpp
===================================================================
--- bolt/lib/Core/Exceptions.cpp
+++ bolt/lib/Core/Exceptions.cpp
@@ -184,12 +184,19 @@
     if (LPAddress < Address || LPAddress > Address + getSize()) {
       BinaryFunction *Fragment =
           BC.getBinaryFunctionContainingAddress(LPAddress);
-      assert(Fragment != nullptr &&
-             "BOLT-ERROR: cannot find landing pad fragment");
+      if (Fragment == nullptr) {
+        errs() << formatv(
+            "BOLT-ERROR: cannot find function for landing pad {0:x}\n",
+            LPAddress);
+        exit(1);
+      }
       BC.addInterproceduralReference(this, Fragment->getAddress());
       BC.processInterproceduralReferences();
-      assert(isParentOrChildOf(*Fragment) &&
-             "BOLT-ERROR: cannot have landing pads in different functions");
+      if (!isParentOrChildOf(*Fragment)) {
+        errs() << formatv("BOLT-ERROR: {0} has landing pad in {1}\n", *this,
+                          *Fragment);
+        exit(1);
+      }
       setHasIndirectTargetToSplitFragment(true);
       BC.addFragmentsToSkip(this);
       return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154146.535978.patch
Type: text/x-patch
Size: 1169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230629/1c64b635/attachment.bin>


More information about the llvm-commits mailing list