diff options
author | Torok Edwin <edwintorok@gmail.com> | 2010-12-23 15:49:26 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2010-12-23 15:49:26 +0000 |
commit | a156efdf71bc668093e31593713694cf076db895 (patch) | |
tree | ffe6ac57259009a2b3b028e9289f5f8258e91601 /bindings/ocaml/bitreader/llvm_bitreader.mli | |
parent | 9d071cbb92e2f28be2067fdb5cf21b396e34838d (diff) | |
download | llvm-a156efdf71bc668093e31593713694cf076db895.tar.gz llvm-a156efdf71bc668093e31593713694cf076db895.tar.bz2 llvm-a156efdf71bc668093e31593713694cf076db895.tar.xz |
Fix OCaml bindings crash, PR8847.
See http://caml.inria.fr/mantis/view.php?id=4166
If we call only external functions from a module, then its 'let _' bindings
don't get executed, which means that the exceptions don't get registered for use
in the C code.
This in turn causes llvm_raise to call raise_with_arg() with a NULL pointer and
cause a segmentation fault.
The workaround is to declare all 'external' functions as 'val' in these .mli
files.
Also added a separate testcase (the testcase must call only external functions
for the bug to occur).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/bitreader/llvm_bitreader.mli')
-rw-r--r-- | bindings/ocaml/bitreader/llvm_bitreader.mli | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bindings/ocaml/bitreader/llvm_bitreader.mli b/bindings/ocaml/bitreader/llvm_bitreader.mli index 5e2240974a..1d333191c1 100644 --- a/bindings/ocaml/bitreader/llvm_bitreader.mli +++ b/bindings/ocaml/bitreader/llvm_bitreader.mli @@ -18,12 +18,12 @@ exception Error of string memory buffer [mb] in the context [context]. Returns [m] if successful, or raises [Error msg] otherwise, where [msg] is a description of the error encountered. See the function [llvm::getBitcodeModule]. *) -external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule - = "llvm_get_module" +val get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule + (** [parse_bitcode context mb] parses the bitcode for a new module [m] from the memory buffer [mb] in the context [context]. Returns [m] if successful, or raises [Error msg] otherwise, where [msg] is a description of the error encountered. See the function [llvm::ParseBitcodeFile]. *) -external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule - = "llvm_parse_bitcode" +val parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule + |