1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

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
This commit is contained in:
Bob Wilson 2009-06-24 21:09:18 +00:00
parent a809ad5166
commit 653f309975
6 changed files with 16 additions and 15 deletions

View File

@ -16,6 +16,7 @@
\*===----------------------------------------------------------------------===*/ \*===----------------------------------------------------------------------===*/
#include "llvm-c/ExecutionEngine.h" #include "llvm-c/ExecutionEngine.h"
#include "llvm-c/Target.h"
#include "caml/alloc.h" #include "caml/alloc.h"
#include "caml/custom.h" #include "caml/custom.h"
#include "caml/fail.h" #include "caml/fail.h"
@ -23,6 +24,12 @@
#include <string.h> #include <string.h>
#include <assert.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 /* Can't use the recommended caml_named_value mechanism for backwards
compatibility reasons. This is largely equivalent. */ compatibility reasons. This is largely equivalent. */

View File

@ -26,6 +26,9 @@
extern "C" { extern "C" {
#endif #endif
void LLVMLinkInJIT(void);
void LLVMLinkInInterpreter(void);
typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef; typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;
typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef; typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;

View File

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

View File

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

View File

@ -29,10 +29,7 @@ static struct RegisterInterp {
} }
namespace llvm { extern "C" void LLVMLinkInInterpreter() { }
void LinkInInterpreter() {
}
}
/// create - Create a new interpreter object. This can never fail. /// create - Create a new interpreter object. This can never fail.
/// ///

View File

@ -60,9 +60,7 @@ static struct RegisterJIT {
} }
namespace llvm { extern "C" void LLVMLinkInJIT() {
void LinkInJIT() {
}
} }