comparison llvm/bindings/ocaml/linker/linker_ocaml.c @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents 79ff65ed7e25
children
comparison
equal deleted inserted replaced
237:c80f45b162ad 252:1f2b6ac9f198
13 |* Note that these functions intentionally take liberties with the CAMLparamX *| 13 |* Note that these functions intentionally take liberties with the CAMLparamX *|
14 |* macros, since most of the parameters are not GC heap objects. *| 14 |* macros, since most of the parameters are not GC heap objects. *|
15 |* *| 15 |* *|
16 \*===----------------------------------------------------------------------===*/ 16 \*===----------------------------------------------------------------------===*/
17 17
18 #include "caml/alloc.h"
19 #include "caml/callback.h"
20 #include "caml/fail.h"
21 #include "caml/memory.h"
22 #include "llvm_ocaml.h"
18 #include "llvm-c/Core.h" 23 #include "llvm-c/Core.h"
19 #include "llvm-c/Linker.h" 24 #include "llvm-c/Linker.h"
20 #include "caml/alloc.h"
21 #include "caml/memory.h"
22 #include "caml/fail.h"
23 #include "caml/callback.h"
24 25
25 void llvm_raise(value Prototype, char *Message); 26 void llvm_raise(value Prototype, char *Message);
26 27
27 /* llmodule -> llmodule -> unit */ 28 /* llmodule -> llmodule -> unit */
28 value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src) { 29 value llvm_link_modules(value Dst, value Src) {
29 if (LLVMLinkModules2(Dst, Src)) 30 if (LLVMLinkModules2(Module_val(Dst), Module_val(Src)))
30 llvm_raise(*caml_named_value("Llvm_linker.Error"), 31 llvm_raise(*caml_named_value("Llvm_linker.Error"),
31 LLVMCreateMessage("Linking failed")); 32 LLVMCreateMessage("Linking failed"));
32 33
33 return Val_unit; 34 return Val_unit;
34 } 35 }