summaryrefslogtreecommitdiffstats
path: root/llvm/bindings/ocaml/bitreader
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2010-12-23 15:49:26 +0000
committerTorok Edwin <edwintorok@gmail.com>2010-12-23 15:49:26 +0000
commit5abf51bde02d6a3987e6c2f0cd76258ff340a870 (patch)
treeeccb6d0dec7d324596246a2e823f33d5d28306cc /llvm/bindings/ocaml/bitreader
parentdfa40f8f195c14b6080ec5214d3d1c7e01ee6195 (diff)
downloadbcm5719-llvm-5abf51bde02d6a3987e6c2f0cd76258ff340a870.tar.gz
bcm5719-llvm-5abf51bde02d6a3987e6c2f0cd76258ff340a870.zip
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). llvm-svn: 122497
Diffstat (limited to 'llvm/bindings/ocaml/bitreader')
-rw-r--r--llvm/bindings/ocaml/bitreader/llvm_bitreader.mli8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/bindings/ocaml/bitreader/llvm_bitreader.mli b/llvm/bindings/ocaml/bitreader/llvm_bitreader.mli
index 5e2240974af..1d333191c1d 100644
--- a/llvm/bindings/ocaml/bitreader/llvm_bitreader.mli
+++ b/llvm/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
+
OpenPOWER on IntegriCloud