[PATCH] D156516: [lli] Fix crash on empty entry-function

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 02:36:18 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGce6303f0e635: [lli] Fix crash on empty entry-function (authored by c-rhodes).

Changed prior to commit:
  https://reviews.llvm.org/D156516?vs=545057&id=545554#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156516/new/

https://reviews.llvm.org/D156516

Files:
  llvm/test/ExecutionEngine/Orc/empty-entry-function.ll
  llvm/tools/lli/lli.cpp


Index: llvm/tools/lli/lli.cpp
===================================================================
--- llvm/tools/lli/lli.cpp
+++ llvm/tools/lli/lli.cpp
@@ -446,6 +446,12 @@
 
   ExitOnErr(loadDylibs());
 
+  if (EntryFunc.empty()) {
+    WithColor::error(errs(), argv[0])
+        << "--entry-function name cannot be empty\n";
+    exit(1);
+  }
+
   if (UseJITKind == JITKind::MCJIT)
     disallowOrcOptions();
   else
Index: llvm/test/ExecutionEngine/Orc/empty-entry-function.ll
===================================================================
--- /dev/null
+++ llvm/test/ExecutionEngine/Orc/empty-entry-function.ll
@@ -0,0 +1,4 @@
+; RUN: not lli --entry-function= %s 2>&1 | FileCheck %s
+;
+; Test empty --entry-function yields an error.
+; CHECK: error: --entry-function name cannot be empty


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156516.545554.patch
Type: text/x-patch
Size: 800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230731/4d9e1eda/attachment.bin>


More information about the llvm-commits mailing list