Expose initializing the native target for the execution engine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81800 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c
index 647759f..072d583 100644
--- a/bindings/ocaml/executionengine/executionengine_ocaml.c
+++ b/bindings/ocaml/executionengine/executionengine_ocaml.c
@@ -24,11 +24,15 @@
 #include <string.h>
 #include <assert.h>
 
-/* Force the LLVM interpreter, JIT, and native target to be linked in. */
+/* Force the LLVM interpreter and JIT to be linked in. */
 void llvm_initialize(void) {
   LLVMLinkInInterpreter();
   LLVMLinkInJIT();
-  LLVMInitializeNativeTarget();
+}
+
+/* unit -> bool */
+CAMLprim value llvm_initialize_native_target(value Unit) {
+  return Val_bool(LLVMInitializeNativeTarget());
 }
 
 /* Can't use the recommended caml_named_value mechanism for backwards
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.ml b/bindings/ocaml/executionengine/llvm_executionengine.ml
index cf9acc7..c9e8f18 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.ml
+++ b/bindings/ocaml/executionengine/llvm_executionengine.ml
@@ -109,3 +109,6 @@
   
    *)
 end
+
+external initialize_native_target : unit -> bool
+                                  = "llvm_initialize_native_target"
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.mli b/bindings/ocaml/executionengine/llvm_executionengine.mli
index 32e2fdf..6c2fdfb 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.mli
+++ b/bindings/ocaml/executionengine/llvm_executionengine.mli
@@ -161,3 +161,6 @@
       [ee]. *)
   val target_data: t -> Llvm_target.TargetData.t
 end
+
+external initialize_native_target : unit -> bool
+                                  = "llvm_initialize_native_target"
diff --git a/docs/tutorial/OCamlLangImpl4.html b/docs/tutorial/OCamlLangImpl4.html
index 7cd54d9..238fc53 100644
--- a/docs/tutorial/OCamlLangImpl4.html
+++ b/docs/tutorial/OCamlLangImpl4.html
@@ -962,6 +962,8 @@
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '&lt;' 10;
diff --git a/docs/tutorial/OCamlLangImpl5.html b/docs/tutorial/OCamlLangImpl5.html
index bd22c5e..f19e900 100644
--- a/docs/tutorial/OCamlLangImpl5.html
+++ b/docs/tutorial/OCamlLangImpl5.html
@@ -1487,6 +1487,8 @@
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '&lt;' 10;
diff --git a/docs/tutorial/OCamlLangImpl6.html b/docs/tutorial/OCamlLangImpl6.html
index 5713188..2edb22e 100644
--- a/docs/tutorial/OCamlLangImpl6.html
+++ b/docs/tutorial/OCamlLangImpl6.html
@@ -1486,6 +1486,8 @@
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '&lt;' 10;
diff --git a/docs/tutorial/OCamlLangImpl7.html b/docs/tutorial/OCamlLangImpl7.html
index 411e040..0776821 100644
--- a/docs/tutorial/OCamlLangImpl7.html
+++ b/docs/tutorial/OCamlLangImpl7.html
@@ -1816,6 +1816,8 @@
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '=' 2;