[PATCH] D92280: [NFC} fix "Target does not support MC emission!" Error in HowToUseJit Example.

Shivam Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 29 12:46:55 PST 2020


xgupta created this revision.
xgupta added reviewers: lhames, jyknight.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
xgupta requested review of this revision.

On running the HowToUseJIT example, after constructing the LLVM module it didn't get JIT compilation instead print the following error message:- Running foo: LLVM ERROR: Target does not support MC emission!
[1]    20154 abort (core dumped)  HowToUseJIT.
So this patch fixes the issue and results as expected print 11.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92280

Files:
  llvm/examples/HowToUseJIT/CMakeLists.txt
  llvm/examples/HowToUseJIT/HowToUseJIT.cpp


Index: llvm/examples/HowToUseJIT/HowToUseJIT.cpp
===================================================================
--- llvm/examples/HowToUseJIT/HowToUseJIT.cpp
+++ llvm/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -36,6 +36,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
+#include "llvm/ExecutionEngine/MCJIT.h"
 #include "llvm/IR/Argument.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constants.h"
@@ -59,6 +60,7 @@
 
 int main() {
   InitializeNativeTarget();
+  LLVMInitializeNativeAsmPrinter();
 
   LLVMContext Context;
   
Index: llvm/examples/HowToUseJIT/CMakeLists.txt
===================================================================
--- llvm/examples/HowToUseJIT/CMakeLists.txt
+++ llvm/examples/HowToUseJIT/CMakeLists.txt
@@ -2,6 +2,8 @@
   Core
   ExecutionEngine
   Interpreter
+  MC
+  MCJIT
   Support
   nativecodegen
   )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92280.308223.patch
Type: text/x-patch
Size: 938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201129/c3990424/attachment.bin>


More information about the llvm-commits mailing list