In order to use this feature, configure LLVM as usual,
but then build and install it as:
make all install SYSTEM_LLVM_CONFIG=llvm-config
where llvm-config is the llvm-config binary installed on your
system (possibly llvm-config-VERSION on e.g. Debian).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225787 91177308-0d34-0410-b5e6-96231b3b80d8
As a result, installations of LLVM in non-standard locations
will not require passing custom -ccopt -L flags when building
the binary, nor absolute paths would be embedded in the cma/cmxa
files. Additionally, the executables will not require changes
to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still
has to be set for ocamlc without -custom.
See http://caml.inria.fr/mantis/view.php?id=6642.
Note that the patch is approved, but not merged yet.
It will be released in 4.03 and likely 4.02.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225778 91177308-0d34-0410-b5e6-96231b3b80d8
Bindings built out-of-tree, e.g. via OPAM, should append
a line to META.llvm like the following:
linkopts = "-cclib -L$libdir -cclib -Wl,-rpath,$libdir"
where $libdir is the lib/ directory where LLVM libraries are
installed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221139 91177308-0d34-0410-b5e6-96231b3b80d8
Since JIT->MCJIT migration, most of the ExecutionEngine interface
became deprecated and/or broken. This especially affected the OCaml
bindings, as runFunction is no longer available, and unlike in C,
it is not possible to coerce a pointer to a function and call it
in OCaml.
In practice, LLVM 3.5 shipped completely unusable
Llvm_executionengine.
The GenericValue interface and runFunction were essentially
a poor man's FFI. As such, this interface was removed and instead
a dependency on ctypes >=0.3 added, which handled platform-specific
aspects of accessing data and calling functions.
The new interface does not expose JIT (which is a shim around MCJIT),
as well as the interpreter (which can't handle a lot of valid IR).
Llvm_executionengine.add_global_mapping is currently unusable
due to PR20656.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220957 91177308-0d34-0410-b5e6-96231b3b80d8
This commit updates the OCaml bindings and tests to use ocamlfind.
The bindings are migrated in order to use ctypes, which are now
required for MCJIT-backed Llvm_executionengine.
The tests are migrated in order to use OUnit and to verify that
the distributed META.llvm allows to build working executables.
Every OCaml toolchain invocation is now chained through ocamlfind,
which (in theory) allows to cross-compile the OCaml bindings.
The configure script now checks for ctypes (>= 0.2.3) and
OUnit (>= 2). The code depending on these libraries will be added
later. The configure script does not check the package versions
in order to keep changes less invasive.
Additionally, OCaml bindings will now be automatically enabled
if ocamlfind is detected on the system, rather than ocamlc, as it
was before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220899 91177308-0d34-0410-b5e6-96231b3b80d8
In practice this means:
* Always using -g flag.
* Embedding -cclib -lstdc++ into the corresponding cma/cmxa file.
This also moves -lstdc++ in a single place.
* Using caml_named_value instead of a homegrown mechanism.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit embeds a set of linker flags with hardcoded paths to
the LLVM shared library on --enable-shared builds into .cmxa files
and stub dynamic libraries. This solution closely follows existing
rules for rpath in the LLVM tools, which had to be modified because
of differences in toolchain.
Without this patch, OCaml tests as well as opam bindings broke,
as neither of those updates LD_LIBRARY_PATH to include
the $prefix/lib directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195834 91177308-0d34-0410-b5e6-96231b3b80d8
This commit significantly speeds up both bytecode and native
builds of LLVM clients (from ~20 second to sub-second link time),
and allows to invoke LLVM functions from OCaml toplevel.
The behavior for --disable-shared builds is unchanged.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194509 91177308-0d34-0410-b5e6-96231b3b80d8
This commit only changes comments and documentation in OCaml bindings. The official name of the language is OCaml, and the usage is now consistent.
Patch by Peter Zotov
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193836 91177308-0d34-0410-b5e6-96231b3b80d8
1. Interface files (.mli) are installed before compiled interface
files (.cmi) to preserve timestamp relation.
2. install-meta should use $(OcamlDir) instead of $(ObjDir).
3. Declared some targets as .PHONY.
Patch by Christophe Raffalli.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144183 91177308-0d34-0410-b5e6-96231b3b80d8
The .cmi files are generated in $(ObjDir) and then copied to $(OcamlDir).
The ocamldep output references the .cmi files in $(ObjDir), so make kicks
off a dependent compile as soon as the local copy is generated. If the
copy to $(OcamlDir) is not complete at that point, the compiler will read
the partially copied file and complain about a "Corrupted compiled
interface". Searching $(ObjDir) first avoids this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66217 91177308-0d34-0410-b5e6-96231b3b80d8
to the ocaml bindings. This is required on Windows where 'ln -sf'
actually creates a copy. Thanks to Alain Frisch for noticing this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44547 91177308-0d34-0410-b5e6-96231b3b80d8
stdlib if it's beneath --prefix, and is libdir/ocaml otherwise.
If someone has a better way than this to test whether $B is a path
within $A, I'd love to hear it:
if test "$A" \< "$B" -a "$B" \< "${A}~"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42532 91177308-0d34-0410-b5e6-96231b3b80d8
instruction creation. No support yet for instruction introspection.
Also eliminated allocas from the Ocaml bindings for portability,
and avoided unnecessary casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42367 91177308-0d34-0410-b5e6-96231b3b80d8