1 (* RUN: rm -rf %t && mkdir -p %t && cp %s %t/linker.ml
2 * RUN: %ocamlc -g -w +A -package llvm.linker -linkpkg %t/linker.ml -o %t/executable
4 * RUN: %ocamlopt -g -w +A -package llvm.linker -linkpkg %t/linker.ml -o %t/executable
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 let diagnostic_handler _
= ()
21 (* Tiny unit test framework - really just to help find which line is busted *)
22 let print_checkpoints = false
25 if print_checkpoints then
26 prerr_endline
(name ^
":");
30 (*===-- Linker -----------------------------------------------------------===*)
33 set_diagnostic_handler
context (Some
diagnostic_handler);
35 let fty = function_type
void_type [| |] in
37 let make_module name
=
38 let m = create_module
context name
in
39 let fn = define_function
("fn_" ^ name
) fty m in
40 ignore
(build_ret_void
(builder_at_end
context (entry_block
fn)));
44 let m1 = make_module "one"
45 and m2
= make_module "two" in
49 let m1 = make_module "one"
50 and m2
= make_module "two" in
54 let m1 = make_module "one"
55 and m2
= make_module "one" in
62 (*===-- Driver ------------------------------------------------------------===*)
65 suite "linker" test_linker