1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

48 Commits

Author SHA1 Message Date
Richard Diamond
de0a495c44 Fix llvm-config to adapt to the install environment.
Summary:
This patch does a couple of things:

  - Adds a new argument `--shared-mode` which accepts a list of components and prints whether or not the provided components need to be linked statically or shared.
  - Fixes `--libnames` when CMake BUILD_SHARED_LIBS is used.
  - Fixes `--libnames`, `--libs`, and `--libfiles` for dylib when static components aren't installed.
  - Fixes `--libnames`, `--libs`, `--libfiles`, and `--components` to use LLVM_DYLIB_COMPONENTS as the component manifest for dylib linking.
  - Uses the host platform's usual convention for filename extensions and such, instead of always defaulting to Unix-izms.

Because I don't own a Mac, I am not able to test the Mac platform dependent stuff locally. If someone would be willing to run a build for me on their machine (unless there's a better option), I'd appreciate it.

Reviewers: jfb, brad.king, whitequark, beanz

Subscribers: beanz, jauhien, llvm-commits

Differential Revision: http://reviews.llvm.org/D13198

llvm-svn: 252532
2015-11-09 23:15:38 +00:00
Richard Diamond
1c21053d08 Revert "Fix llvm-config to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components."
It seems I was wrong thinking `autoconf`/`make` only installed shared libraries if configured with `--enable-shared`, even if `--disable-static` is present. I'll re-address with a followup patch.

This reverts commit r243297 for causing PR#24154.

llvm-svn: 244108
2015-08-05 20:03:26 +00:00
JF Bastien
249f34fc9a Fix llvm-config to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components.
Summary:
When LLVM is configured to build shared libraries, CMake builds each component as it's own shared object, while autoconfig/make builds them statically and then links them all together to create a single shared object. This change adds compile time config flags to `llvm-config` so it can know whether LLVM's components are separated or not and act accordingly.

This fixes `llvm-config` instead of fixing the makefiles to behave like CMake because, AIUI, LLVM's autoconfig/make build system is on the way out anyway.

This change only affects `llvm-config` from builds that use autoconfig/make.

Reviewers: jfb

Subscribers: echristo, dschuff, llvm-commits

Differential Revision: http://reviews.llvm.org/D11392

llvm-svn: 243297
2015-07-27 18:26:30 +00:00
Peter Zotov
b21759952e [OCaml] Allow out-of-tree builds of LLVM bindings.
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).

llvm-svn: 225787
2015-01-13 12:17:56 +00:00
Peter Zotov
807dc63755 [OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.
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.

llvm-svn: 225778
2015-01-13 09:47:59 +00:00
Peter Zotov
41942af9a1 [OCaml] PR22014: OCaml bindings didn't link to libLLVM-*.so with -Wl,--as-needed
Patch by Evangelos Foutras <evangelos@foutrelis.com>.

llvm-svn: 224766
2014-12-23 13:09:59 +00:00
Peter Zotov
260d1b1b77 [OCaml] Add -g on DEBUG_SYMBOLS=1, not ENABLE_OPTIMIZED.
Thanks echristo for pointing this out.

llvm-svn: 221145
2014-11-03 10:06:19 +00:00
Peter Zotov
b4e4fed74d [OCaml] Fix ocamlc -custom builds when configured as --enable-shared.
llvm-svn: 221140
2014-11-03 09:51:37 +00:00
Peter Zotov
3c929e8a6a [OCaml] Avoid embedding absolute paths into executables.
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.

llvm-svn: 221139
2014-11-03 09:51:34 +00:00
Peter Zotov
ee1171d3fa [OCaml] Don't build stub libraries twice.
The default Makefile.rules BUILD_ARCHIVE machinery was
unintentionally enabled.

llvm-svn: 221138
2014-11-03 09:51:28 +00:00
Peter Zotov
5dda7d9855 [OCaml] Rework Llvm_executionengine using ctypes.
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.

llvm-svn: 220957
2014-10-31 09:05:36 +00:00
Peter Zotov
c22ad454f5 [OCaml] [autoconf] Migrate to ocamlfind.
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.

llvm-svn: 220899
2014-10-30 08:29:45 +00:00
Peter Zotov
92738ae9a2 [OCaml] Drop support for 3.12.1 and earlier.
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.

llvm-svn: 220843
2014-10-29 08:15:54 +00:00
Peter Zotov
da5425e252 [OCaml] Enable -g for debug builds.
We don't care about pre-3.12.1 anymore.

llvm-svn: 220767
2014-10-28 06:15:41 +00:00
Peter Zotov
41625b6878 [OCaml] Fix whitespace.
llvm-svn: 220766
2014-10-28 06:15:18 +00:00
NAKAMURA Takumi
0c7582f249 Makefile.ocaml: Tweak to use --system-libs.
llvm-svn: 197758
2013-12-20 00:36:59 +00:00
Peter Zotov
f783e4243e [OCaml] Add a slash accidentally omitted from Makefile
llvm-svn: 195912
2013-11-28 09:03:28 +00:00
Peter Zotov
4ae3b7518c [OCaml] Embed rpath into stub libraries and native executables
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.

llvm-svn: 195834
2013-11-27 11:03:18 +00:00
Peter Zotov
e3fdb03df7 [OCaml] Embed the flags necessary for linking with libLLVM.so into .cmxa files
llvm-svn: 195782
2013-11-26 20:40:34 +00:00
Peter Zotov
e66ae0045d [OCaml] Fix building of stub libraries
llvm-svn: 194772
2013-11-15 02:51:27 +00:00
Peter Zotov
b163e08a96 [OCaml] Dynamically link LLVM on --enable-shared builds
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.

llvm-svn: 194509
2013-11-12 20:55:49 +00:00
Sylvestre Ledru
3cdf499ddf OCaml bindings: fix typo
Patch by Peter Zotov

llvm-svn: 193845
2013-11-01 01:10:58 +00:00
Sylvestre Ledru
f2e94c88f0 OCaml bindings: formatting
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

llvm-svn: 193836
2013-11-01 00:26:01 +00:00
Wojciech Matyjewicz
b017bc6c32 Minor fixes in Makefiles for the OCaml bindings:
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.

llvm-svn: 144183
2011-11-09 12:00:39 +00:00
Erick Tryzelaar
4a621556e4 Fix compiling the ocaml kaleidoscope tutorials
llvm-svn: 125202
2011-02-09 18:32:02 +00:00
Erick Tryzelaar
0e12fd5fc2 Add OCaml tutorial to the examples.
llvm-svn: 97966
2010-03-08 19:32:27 +00:00
Bob Wilson
93f8ae1d35 Fix another parallel make race condition.
llvm-svn: 91709
2009-12-18 20:12:14 +00:00
Bob Wilson
5e2c59df82 Fix pr4820: Don't run llvm-config during "make clean" since it may have
already been removed.

llvm-svn: 81547
2009-09-11 18:42:18 +00:00
Bob Wilson
fbcb5235b0 Fix a parallel make race condition by swapping the order of -I directories.
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.

llvm-svn: 66217
2009-03-06 00:00:58 +00:00
Nick Lewycky
bc0bb948cc Remove libtool.
llvm-svn: 65517
2009-02-26 07:44:16 +00:00
Gordon Henriksen
2bedc8476d Refresh Makefile.ocaml in objdir if it is modified in srcdir.
Patch by Erick Tryzelaar!

llvm-svn: 48150
2008-03-10 16:15:32 +00:00
Gordon Henriksen
7af7f7f186 Adding ocamldoc generation.
Patch by Erick Tryzelaar.

llvm-svn: 48147
2008-03-10 15:49:16 +00:00
Gordon Henriksen
20c6e292a5 Fix a typo. 'make clean' in bindings/ocaml would leave an output.
llvm-svn: 48012
2008-03-07 18:43:51 +00:00
Gordon Henriksen
1850fc4fa2 Fix a typo noticed by Erick Tryzelaar,
llvm-svn: 47886
2008-03-04 14:52:05 +00:00
Gordon Henriksen
87171d82dc Modify Makefile.rules to allow makefiles to prepend to C.Flags and
fiends. Change Makefile.ocaml to not touch CFLAGS.

llvm-svn: 45663
2008-01-06 21:54:35 +00:00
Gordon Henriksen
35d9fcb448 Quote a path in the Ocaml makefile which is likely to include spaces on Windows.
llvm-svn: 45580
2008-01-04 11:55:57 +00:00
Chris Lattner
6aece93d5c remove attributions from the rest of the llvm makefiles.
llvm-svn: 45416
2007-12-29 20:11:13 +00:00
Gordon Henriksen
653a9e4c7f Disabling -g for ocaml builds; it's not downwards compatible.
llvm-svn: 45352
2007-12-25 08:37:43 +00:00
Gordon Henriksen
606ac32019 C and Ocaml bindings for ExecutionEngine (i.e., the JIT compiler).
llvm-svn: 45335
2007-12-23 16:59:28 +00:00
Gordon Henriksen
90d6c0aea2 Track dependencies when creating symlinks to LLVM libraries next
to the ocaml bindings. This is required on Windows where 'ln -sf'
actually creates a copy. Thanks to Alain Frisch for noticing this.

llvm-svn: 44547
2007-12-03 21:15:53 +00:00
Gordon Henriksen
acf0aac0c1 Fix ocaml bindings for picky linkers. :)
Thanks to Török Edvin for helping to track this down.

llvm-svn: 42927
2007-10-12 19:48:13 +00:00
Gordon Henriksen
06eeba26c1 Bindings for the verifier.
llvm-svn: 42707
2007-10-06 21:00:36 +00:00
Gordon Henriksen
e2d253991d Do use the actual ocaml stdlib (not the install dir) to find the
caml/*.h headers.

llvm-svn: 42599
2007-10-04 00:07:50 +00:00
Gordon Henriksen
eca47fe7df Providing --with-ocaml-libdir for ./configure. The default is the
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}~"

llvm-svn: 42532
2007-10-02 16:42:10 +00:00
Gordon Henriksen
c73d5c73a6 Added C and Ocaml bindings for functions, basic blocks, and
instruction creation. No support yet for instruction introspection.

Also eliminated allocas from the Ocaml bindings for portability,
and avoided unnecessary casts.

llvm-svn: 42367
2007-09-26 20:56:12 +00:00
Gordon Henriksen
7b659bff9c Fix srcdir <> objdir builds with ocaml 2.10. Downrev versions don't care whether
'dir' exists in 'ocamldep -I dir ...', but recent ones demand that it actually
exists.

llvm-svn: 42245
2007-09-23 13:37:44 +00:00
Gordon Henriksen
0728757caf Incorporating review feedback for GC verifier patch.
llvm-svn: 42163
2007-09-20 16:47:41 +00:00
Gordon Henriksen
a8db66a37a (no commit message)
llvm-svn: 42090
2007-09-18 12:26:17 +00:00