[llvm-commits] [llvm] r74117 - in /llvm/trunk: bindings/ocaml/executionengine/executionengine_ocaml.c include/llvm-c/ExecutionEngine.h include/llvm/ExecutionEngine/Interpreter.h include/llvm/ExecutionEngine/JIT.h lib/ExecutionEngine/Interpreter/Interpreter.cpp lib/ExecutionEngine/JIT/JIT.cpp

Bob Wilson bob.wilson at apple.com
Wed Jun 24 14:09:26 PDT 2009


Author: bwilson
Date: Wed Jun 24 16:09:18 2009
New Revision: 74117

URL: http://llvm.org/viewvc/llvm-project?rev=74117&view=rev
Log:
Fix the Ocaml bindings for the ExecutionEngine: with the change to build
libraries instead of relinked objects, the interpreter, JIT, and native
target libraries were not being linked in to an ocaml program using the
ExecutionEngine.

Modified:
    llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c
    llvm/trunk/include/llvm-c/ExecutionEngine.h
    llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h
    llvm/trunk/include/llvm/ExecutionEngine/JIT.h
    llvm/trunk/lib/ExecutionEngine/Interpreter/Interpreter.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp

Modified: llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c?rev=74117&r1=74116&r2=74117&view=diff

==============================================================================
--- llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c Wed Jun 24 16:09:18 2009
@@ -16,6 +16,7 @@
 \*===----------------------------------------------------------------------===*/
 
 #include "llvm-c/ExecutionEngine.h"
+#include "llvm-c/Target.h"
 #include "caml/alloc.h"
 #include "caml/custom.h"
 #include "caml/fail.h"
@@ -23,6 +24,12 @@
 #include <string.h>
 #include <assert.h>
 
+/* Force the LLVM interpreter, JIT, and native target to be linked in. */
+void llvm_initialize(void) {
+  LLVMLinkInInterpreter();
+  LLVMLinkInJIT();
+  LLVMInitializeNativeTarget();
+}
 
 /* Can't use the recommended caml_named_value mechanism for backwards
    compatibility reasons. This is largely equivalent. */

Modified: llvm/trunk/include/llvm-c/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=74117&r1=74116&r2=74117&view=diff

==============================================================================
--- llvm/trunk/include/llvm-c/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm-c/ExecutionEngine.h Wed Jun 24 16:09:18 2009
@@ -26,6 +26,9 @@
 extern "C" {
 #endif
 
+void LLVMLinkInJIT(void);
+void LLVMLinkInInterpreter(void);
+
 typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;
 typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;
 

Modified: llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h?rev=74117&r1=74116&r2=74117&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Interpreter.h Wed Jun 24 16:09:18 2009
@@ -18,9 +18,7 @@
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include <cstdlib>
 
-namespace llvm {
-  extern void LinkInInterpreter();
-}
+extern "C" void LLVMLinkInInterpreter();
 
 namespace {
   struct ForceInterpreterLinking {
@@ -32,7 +30,7 @@
       if (std::getenv("bar") != (char*) -1)
         return;
 
-      llvm::LinkInInterpreter();
+      LLVMLinkInInterpreter();
     }
   } ForceInterpreterLinking;
 }

Modified: llvm/trunk/include/llvm/ExecutionEngine/JIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JIT.h?rev=74117&r1=74116&r2=74117&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/JIT.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/JIT.h Wed Jun 24 16:09:18 2009
@@ -18,9 +18,7 @@
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include <cstdlib>
 
-namespace llvm {
-  extern void LinkInJIT();
-}
+extern "C" void LLVMLinkInJIT();
 
 namespace {
   struct ForceJITLinking {
@@ -32,7 +30,7 @@
       if (std::getenv("bar") != (char*) -1)
         return;
 
-      llvm::LinkInJIT();
+      LLVMLinkInJIT();
     }
   } ForceJITLinking;
 }

Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Interpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/Interpreter.cpp?rev=74117&r1=74116&r2=74117&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Interpreter/Interpreter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Interpreter/Interpreter.cpp Wed Jun 24 16:09:18 2009
@@ -29,10 +29,7 @@
 
 }
 
-namespace llvm {
-  void LinkInInterpreter() {
-  }
-}
+extern "C" void LLVMLinkInInterpreter() { }
 
 /// create - Create a new interpreter object.  This can never fail.
 ///

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=74117&r1=74116&r2=74117&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Jun 24 16:09:18 2009
@@ -60,9 +60,7 @@
 
 }
 
-namespace llvm {
-  void LinkInJIT() {
-  }
+extern "C" void LLVMLinkInJIT() {
 }
 
 





More information about the llvm-commits mailing list