1 (* RUN: rm -rf %t.builddir
2 * RUN: mkdir -p %t.builddir
3 * RUN: cp %s %t.builddir
4 * RUN: %ocamlopt -warn-error A llvm.cmxa llvm_linker.cmxa %t.builddir/linker.ml -o %t
9 (* Note: It takes several seconds for ocamlopt to link an executable with
10 libLLVMCore.a, so it's better to write a big test than a bunch of
16 let context = global_context ()
17 let void_type = Llvm.void_type context
19 (* Tiny unit test framework - really just to help find which line is busted *)
20 let print_checkpoints = false
23 if print_checkpoints then
24 prerr_endline (name ^ ":");
28 (*===-- Linker -----------------------------------------------------------===*)
31 let fty = function_type void_type [| |] in
33 let make_module name =
34 let m = create_module context name in
35 let fn = define_function ("fn_" ^ name) fty m in
36 ignore (build_ret_void (builder_at_end context (entry_block fn)));
40 let m1 = make_module "one"
41 and m2 = make_module "two" in
42 link_modules m1 m2 Mode.PreserveSource;
46 let m1 = make_module "one"
47 and m2 = make_module "two" in
48 link_modules m1 m2 Mode.DestroySource;
51 let m1 = make_module "one"
52 and m2 = make_module "one" in
54 link_modules m1 m2 Mode.PreserveSource;
60 (*===-- Driver ------------------------------------------------------------===*)
63 suite "linker" test_linker