[examples] Fix Kaleidoscope for Windows
authorLang Hames <lhames@gmail.com>
Thu, 19 Aug 2021 03:17:35 +0000 (13:17 +1000)
committerLang Hames <lhames@gmail.com>
Thu, 19 Aug 2021 03:20:51 +0000 (13:20 +1000)
This fixes "Resolving symbol with incorrect flags" errors when running the
Kaleidoscope tutorials on Windows.

Reviewed By: lhames

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

llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h

index 18a4c11..457a2d4 100644 (file)
@@ -54,6 +54,10 @@ public:
     MainJD.addGenerator(
         cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
             DL.getGlobalPrefix())));
+    if (JTMB.getTargetTriple().isOSBinFormatCOFF()) {
+      ObjectLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
+      ObjectLayer.setAutoClaimResponsibilityForObjectSymbols(true);
+    }
   }
 
   ~KaleidoscopeJIT() {