This is an archive of the discontinued LLVM Phabricator instance.

[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG
ClosedPublic

Authored by mgorny on Jul 26 2017, 9:29 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Jul 26 2017, 9:29 AM
whitequark requested changes to this revision.Jul 26 2017, 9:32 AM
whitequark added inline comments.
bindings/ocaml/llvm/llvm_ocaml.c
343 ↗(On Diff #108305)
caml_raise_with_arg(*caml_named_value("Llvm.FeatureDisabled"), caml_copy_string("dump"))
This revision now requires changes to proceed.Jul 26 2017, 9:32 AM
mgorny updated this revision to Diff 108315.Jul 26 2017, 10:08 AM
mgorny edited edge metadata.
mgorny marked an inline comment as done.
whitequark added inline comments.Jul 26 2017, 10:11 AM
bindings/ocaml/llvm/llvm_ocaml.c
344 ↗(On Diff #108315)

It's defined as

CAMLextern value caml_copy_string (char const *);

you can just use caml_copy_string("dump").

mgorny updated this revision to Diff 108318.Jul 26 2017, 10:18 AM
This revision is now accepted and ready to land.Jul 27 2017, 12:34 PM
This revision was automatically updated to reflect the committed changes.