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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74117 91177308-0d34-0410-b5e6-96231b3b80d8
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. */