When creating a JIT, try to load the program so that we can resolve symbols
authorNick Lewycky <nicholas@mxc.ca>
Tue, 17 Aug 2010 16:19:18 +0000 (16:19 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Tue, 17 Aug 2010 16:19:18 +0000 (16:19 +0000)
against it. This affects Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/JIT.cpp

index 677feb21e160b1fc12bc53cc3c058a97cf703f70..63125b79c8e26c25a229949cdd0bda91833e7893 100644 (file)
@@ -219,6 +219,9 @@ ExecutionEngine *JIT::createJIT(Module *M,
                                 StringRef MArch,
                                 StringRef MCPU,
                                 const SmallVectorImpl<std::string>& MAttrs) {
+  // Try to register the program as a source of symbols to resolve against.
+  sys::DynamicLibrary::LoadLibraryPermanently(0, NULL);
+
   // Pick a target either via -march or by guessing the native arch.
   TargetMachine *TM = JIT::selectTarget(M, MArch, MCPU, MAttrs, ErrorStr);
   if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0;