<div dir="ltr">+Lang <br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 16, 2019 at 4:58 AM Damian Smith via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>When following the tutorial and came to Kaleidoscope chapter4 the code was crashing when running the following code:<br></div><div><div>def testfunc(x y) x + y*2;</div><div>testfunc(4, 10);</div><div><br></div><div>I then patched the code:</div><div>1) Make sure ForceInterpreterLinking is defined, to avoid an error "interpreter has not been linked".<br></div><div>2) When Finding the symbol we only looked for external functions in Kaleidoscope.</div><div>After that the code does on no longer crash.</div><div><br></div><div>There is still an issue when entering empty strings, but I a fix for this might come later.</div><div><br></div><div>Here is the diff from git 5aae26ab876 :</div><div><br></div><div>diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp</div><div>index f141fa5a7f5..a0ec57a1f51 100644</div><div>--- a/examples/HowToUseJIT/HowToUseJIT.cpp</div><div>+++ b/examples/HowToUseJIT/HowToUseJIT.cpp</div><div>@@ -37,6 +37,7 @@</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/ADT/STLExtras.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/ExecutionEngine.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/GenericValue.h"</div><div>+#include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/Interpreter.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/IR/Argument.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/IR/BasicBlock.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/IR/Constants.h"</div><div>diff --git a/examples/Kaleidoscope/Chapter4/CMakeLists.txt b/examples/Kaleidoscope/Chapter4/CMakeLists.txt</div><div>index fdc083e0768..599e19fba8d 100644</div><div>--- a/examples/Kaleidoscope/Chapter4/CMakeLists.txt</div><div>+++ b/examples/Kaleidoscope/Chapter4/CMakeLists.txt</div><div>@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS</div><div>   Analysis</div><div>   Core</div><div>   ExecutionEngine</div><div>+  Interpreter</div><div>   InstCombine</div><div>   Object</div><div>   OrcJIT</div><div>diff --git a/examples/Kaleidoscope/Chapter5/CMakeLists.txt b/examples/Kaleidoscope/Chapter5/CMakeLists.txt</div><div>index 757d901ef52..aa6cbc0ebf9 100644</div><div>--- a/examples/Kaleidoscope/Chapter5/CMakeLists.txt</div><div>+++ b/examples/Kaleidoscope/Chapter5/CMakeLists.txt</div><div>@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS</div><div>   Analysis</div><div>   Core</div><div>   ExecutionEngine</div><div>+  Interpreter</div><div>   InstCombine</div><div>   Object</div><div>   OrcJIT</div><div>diff --git a/examples/Kaleidoscope/Chapter6/CMakeLists.txt b/examples/Kaleidoscope/Chapter6/CMakeLists.txt</div><div>index ad50928a346..84ce6d26e4f 100644</div><div>--- a/examples/Kaleidoscope/Chapter6/CMakeLists.txt</div><div>+++ b/examples/Kaleidoscope/Chapter6/CMakeLists.txt</div><div>@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS</div><div>   Analysis</div><div>   Core</div><div>   ExecutionEngine</div><div>+  Interpreter</div><div>   InstCombine</div><div>   Object</div><div>   OrcJIT</div><div>diff --git a/examples/Kaleidoscope/Chapter7/CMakeLists.txt b/examples/Kaleidoscope/Chapter7/CMakeLists.txt</div><div>index 03220358ab7..d3fe2d78e25 100644</div><div>--- a/examples/Kaleidoscope/Chapter7/CMakeLists.txt</div><div>+++ b/examples/Kaleidoscope/Chapter7/CMakeLists.txt</div><div>@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS</div><div>   Analysis</div><div>   Core</div><div>   ExecutionEngine</div><div>+  Interpreter</div><div>   InstCombine</div><div>   Object</div><div>   OrcJIT</div><div>diff --git a/examples/Kaleidoscope/Chapter9/CMakeLists.txt b/examples/Kaleidoscope/Chapter9/CMakeLists.txt</div><div>index 565a7ffd32e..83544874f7f 100644</div><div>--- a/examples/Kaleidoscope/Chapter9/CMakeLists.txt</div><div>+++ b/examples/Kaleidoscope/Chapter9/CMakeLists.txt</div><div>@@ -1,6 +1,7 @@</div><div> set(LLVM_LINK_COMPONENTS</div><div>   Core</div><div>   ExecutionEngine</div><div>+  Interpreter</div><div>   Object</div><div>   OrcJIT</div><div>   Support</div><div>diff --git a/examples/Kaleidoscope/include/KaleidoscopeJIT.h b/examples/Kaleidoscope/include/KaleidoscopeJIT.h</div><div>index 972773a64f7..dc42d599c2f 100644</div><div>--- a/examples/Kaleidoscope/include/KaleidoscopeJIT.h</div><div>+++ b/examples/Kaleidoscope/include/KaleidoscopeJIT.h</div><div>@@ -24,6 +24,7 @@</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/RTDyldMemoryManager.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/SectionMemoryManager.h"</div><div>+#include "<span class="m_6189996102520503656gmail-il">llvm</span>/ExecutionEngine/Interpreter.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/IR/DataLayout.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/IR/Mangler.h"</div><div> #include "<span class="m_6189996102520503656gmail-il">llvm</span>/Support/DynamicLibrary.h"</div><div>@@ -47,7 +48,7 @@ public:</div><div>       : Resolver(createLegacyLookupResolver(</div><div>             ES,</div><div>             [this](const std::string &Name) {</div><div>-              return ObjectLayer.findSymbol(Name, true);</div><div>+              return ObjectLayer.findSymbol(Name, false);</div><div>             },</div><div>             [](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),</div><div>         TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),</div></div></div>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>