aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bindings/ocaml/executionengine/executionengine_ocaml.c7
-rw-r--r--include/llvm-c/ExecutionEngine.h3
-rw-r--r--include/llvm/ExecutionEngine/Interpreter.h6
-rw-r--r--include/llvm/ExecutionEngine/JIT.h6
-rw-r--r--lib/ExecutionEngine/Interpreter/Interpreter.cpp5
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp4
6 files changed, 16 insertions, 15 deletions
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c
index ec40338..647759f 100644
--- a/bindings/ocaml/executionengine/executionengine_ocaml.c
+++ b/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/include/llvm-c/ExecutionEngine.h b/include/llvm-c/ExecutionEngine.h
index a31dc82..9877b8d 100644
--- a/include/llvm-c/ExecutionEngine.h
+++ b/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/include/llvm/ExecutionEngine/Interpreter.h b/include/llvm/ExecutionEngine/Interpreter.h
index b2b0464..7425cdb 100644
--- a/include/llvm/ExecutionEngine/Interpreter.h
+++ b/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/include/llvm/ExecutionEngine/JIT.h b/include/llvm/ExecutionEngine/JIT.h
index d4d1e73..6013db4 100644
--- a/include/llvm/ExecutionEngine/JIT.h
+++ b/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/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
index ded65d5..d7f38ef 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp
+++ b/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/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 43995cb..14d8d5b 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -60,9 +60,7 @@ static struct RegisterJIT {
}
-namespace llvm {
- void LinkInJIT() {
- }
+extern "C" void LLVMLinkInJIT() {
}