[llvm] b3d7e76 - [examples] Fix "Target does not support MC emission!" in HowToUseJIT example.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 24 03:12:04 PST 2021


Author: Lang Hames
Date: 2021-01-24T22:11:54+11:00
New Revision: b3d7e761e347d562333893652dcf3837fa55d777

URL: https://github.com/llvm/llvm-project/commit/b3d7e761e347d562333893652dcf3837fa55d777
DIFF: https://github.com/llvm/llvm-project/commit/b3d7e761e347d562333893652dcf3837fa55d777.diff

LOG: [examples] Fix "Target does not support MC emission!" in HowToUseJIT example.

Patch by Shivam Gupta. Thanks Shivam!

Differential Revision: https://reviews.llvm.org/D92280

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/examples/HowToUseJIT/CMakeLists.txt b/llvm/examples/HowToUseJIT/CMakeLists.txt
index e86626d5cec6..fb0adde378ba 100644
--- a/llvm/examples/HowToUseJIT/CMakeLists.txt
+++ b/llvm/examples/HowToUseJIT/CMakeLists.txt
@@ -2,6 +2,8 @@ set(LLVM_LINK_COMPONENTS
   Core
   ExecutionEngine
   Interpreter
+  MC
+  MCJIT
   Support
   nativecodegen
   )

diff  --git a/llvm/examples/HowToUseJIT/HowToUseJIT.cpp b/llvm/examples/HowToUseJIT/HowToUseJIT.cpp
index c7b3b9a7457c..f7ec2694b947 100644
--- a/llvm/examples/HowToUseJIT/HowToUseJIT.cpp
+++ b/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 @@ using namespace llvm;
 
 int main() {
   InitializeNativeTarget();
+  LLVMInitializeNativeAsmPrinter();
 
   LLVMContext Context;
   


        


More information about the llvm-commits mailing list