diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-06-24 21:09:18 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-06-24 21:09:18 +0000 |
commit | a1d3e660aef0ad88553c1d9ded5fb672a8427f89 (patch) | |
tree | af2eb14e04ab60f44f0a82c6cede397d3d72747f | |
parent | c3aff2c3fae52960af8f780097bf351126bef2b1 (diff) | |
download | bcm5719-llvm-a1d3e660aef0ad88553c1d9ded5fb672a8427f89.tar.gz bcm5719-llvm-a1d3e660aef0ad88553c1d9ded5fb672a8427f89.zip |
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.
llvm-svn: 74117
-rw-r--r-- | llvm/bindings/ocaml/executionengine/executionengine_ocaml.c | 7 | ||||
-rw-r--r-- | llvm/include/llvm-c/ExecutionEngine.h | 3 | ||||
-rw-r--r-- | llvm/include/llvm/ExecutionEngine/Interpreter.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/ExecutionEngine/JIT.h | 6 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.cpp | 4 |
6 files changed, 16 insertions, 15 deletions
diff --git a/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c b/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c index ec403380ef4..647759fb074 100644 --- a/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c +++ b/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c @@ -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. */ diff --git a/llvm/include/llvm-c/ExecutionEngine.h b/llvm/include/llvm-c/ExecutionEngine.h index a31dc8246a3..9877b8d5095 100644 --- a/llvm/include/llvm-c/ExecutionEngine.h +++ b/llvm/include/llvm-c/ExecutionEngine.h @@ -26,6 +26,9 @@ extern "C" { #endif +void LLVMLinkInJIT(void); +void LLVMLinkInInterpreter(void); + typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef; typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef; diff --git a/llvm/include/llvm/ExecutionEngine/Interpreter.h b/llvm/include/llvm/ExecutionEngine/Interpreter.h index b2b04645dfe..7425cdbcfda 100644 --- a/llvm/include/llvm/ExecutionEngine/Interpreter.h +++ b/llvm/include/llvm/ExecutionEngine/Interpreter.h @@ -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 @@ namespace { if (std::getenv("bar") != (char*) -1) return; - llvm::LinkInInterpreter(); + LLVMLinkInInterpreter(); } } ForceInterpreterLinking; } diff --git a/llvm/include/llvm/ExecutionEngine/JIT.h b/llvm/include/llvm/ExecutionEngine/JIT.h index d4d1e73d1ba..6013db48ce6 100644 --- a/llvm/include/llvm/ExecutionEngine/JIT.h +++ b/llvm/include/llvm/ExecutionEngine/JIT.h @@ -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 @@ namespace { if (std::getenv("bar") != (char*) -1) return; - llvm::LinkInJIT(); + LLVMLinkInJIT(); } } ForceJITLinking; } diff --git a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp index ded65d54670..d7f38ef548f 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp @@ -29,10 +29,7 @@ static struct RegisterInterp { } -namespace llvm { - void LinkInInterpreter() { - } -} +extern "C" void LLVMLinkInInterpreter() { } /// create - Create a new interpreter object. This can never fail. /// diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index 43995cb0ecd..14d8d5b12ae 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp @@ -60,9 +60,7 @@ static struct RegisterJIT { } -namespace llvm { - void LinkInJIT() { - } +extern "C" void LLVMLinkInJIT() { } |