[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG
Account for the possibility of LLVMDumpType() not being available with NDEBUG in the OCaml bindings. If it is not built into LLVM, make the dump function raise an exception. Since rL293359, the dump functions are built only if either NDEBUG is not defined, or LLVM_ENABLE_DUMP is defined. As a result, if the dump functions are not built in LLVM, the dynamic OCaml libraries fail to load due to undefined LLVMDumpType symbol. Differential Revision: https://reviews.llvm.org/D35899 llvm-svn: 309321
This commit is contained in:
parent
3073ff9fd3
commit
83012b4721
|
@ -20,6 +20,10 @@ type llattribute
|
|||
type llmemorybuffer
|
||||
type llmdkind
|
||||
|
||||
exception FeatureDisabled of string
|
||||
|
||||
let () = Callback.register_exception "Llvm.FeatureDisabled" (FeatureDisabled "")
|
||||
|
||||
module TypeKind = struct
|
||||
type t =
|
||||
| Void
|
||||
|
|
|
@ -371,6 +371,8 @@ type ('a, 'b) llrev_pos =
|
|||
|
||||
(** {6 Exceptions} *)
|
||||
|
||||
exception FeatureDisabled of string
|
||||
|
||||
exception IoError of string
|
||||
|
||||
|
||||
|
|
|
@ -336,7 +336,12 @@ CAMLprim LLVMContextRef llvm_type_context(LLVMTypeRef Ty) {
|
|||
|
||||
/* lltype -> unit */
|
||||
CAMLprim value llvm_dump_type(LLVMTypeRef Val) {
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
LLVMDumpType(Val);
|
||||
#else
|
||||
caml_raise_with_arg(*caml_named_value("Llvm.FeatureDisabled"),
|
||||
caml_copy_string("dump"));
|
||||
#endif
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue