diff options
8 files changed, 119 insertions, 22 deletions
diff --git a/bindings/go/llvm/linker.go b/bindings/go/llvm/linker.go
index 64d794efb94e..31e9ad24bf52 100644
--- a/bindings/go/llvm/linker.go
+++ b/bindings/go/llvm/linker.go
@@ -20,9 +20,16 @@ package llvm
import "C"
import "errors"
-func LinkModules(Dest, Src Module) error {
+type LinkerMode C.LLVMLinkerMode
+const (
+ LinkerDestroySource = C.LLVMLinkerDestroySource
+ LinkerPreserveSource = C.LLVMLinkerPreserveSource
+func LinkModules(Dest, Src Module, Mode LinkerMode) error {
var cmsg *C.char
- failed := C.LLVMLinkModules(Dest.C, Src.C, 0, &cmsg)
+ failed := C.LLVMLinkModules(Dest.C, Src.C, C.LLVMLinkerMode(Mode), &cmsg)
if failed != 0 {
err := errors.New(C.GoString(cmsg))
diff --git a/bindings/ocaml/linker/linker_ocaml.c b/bindings/ocaml/linker/linker_ocaml.c
index 3b8512aa5953..ed37777d852c 100644
--- a/bindings/ocaml/linker/linker_ocaml.c
+++ b/bindings/ocaml/linker/linker_ocaml.c
@@ -23,11 +23,11 @@
void llvm_raise(value Prototype, char *Message);
-/* llmodule -> llmodule -> unit */
-CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src) {
+/* llmodule -> llmodule -> Mode.t -> unit */
+CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src, value Mode) {
char* Message;
- if (LLVMLinkModules(Dst, Src, 0, &Message))
+ if (LLVMLinkModules(Dst, Src, Int_val(Mode), &Message))
llvm_raise(*caml_named_value("Llvm_linker.Error"), Message);
return Val_unit;
diff --git a/bindings/ocaml/linker/llvm_linker.ml b/bindings/ocaml/linker/llvm_linker.ml
index 3044abd8b6cf..5854d70bb525 100644
--- a/bindings/ocaml/linker/llvm_linker.ml
+++ b/bindings/ocaml/linker/llvm_linker.ml
@@ -11,5 +11,11 @@ exception Error of string
let () = Callback.register_exception "Llvm_linker.Error" (Error "")
-external link_modules : Llvm.llmodule -> Llvm.llmodule -> unit
+module Mode = struct
+ type t =
+ | DestroySource
+ | PreserveSource
+external link_modules : Llvm.llmodule -> Llvm.llmodule -> Mode.t -> unit
= "llvm_link_modules"
diff --git a/bindings/ocaml/linker/llvm_linker.mli b/bindings/ocaml/linker/llvm_linker.mli
index 06c3b92a577e..4def7a8cc983 100644
--- a/bindings/ocaml/linker/llvm_linker.mli
+++ b/bindings/ocaml/linker/llvm_linker.mli
@@ -14,6 +14,13 @@
exception Error of string
+(** Linking mode. *)
+module Mode : sig
+ type t =
+ | DestroySource
+ | PreserveSource
(** [link_modules dst src mode] links [src] into [dst], raising [Error]
if the linking fails. *)
-val link_modules : Llvm.llmodule -> Llvm.llmodule -> unit \ No newline at end of file
+val link_modules : Llvm.llmodule -> Llvm.llmodule -> Mode.t -> unit \ No newline at end of file
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index d769b348ab70..04d7f5266510 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -37,7 +37,8 @@ Non-comprehensive list of changes in this release
* Added support for a `native object file-based bitcode wrapper format
-* ... next change ...
+* Added support for MSVC's ``__vectorcall`` calling convention as
+ ``x86_vectorcallcc``.
If you would like to document a larger change, then you can add a
@@ -293,12 +294,13 @@ The old JIT has been removed
All users should transition to MCJIT.
-object::Binary doesn't owns the file buffer
+object::Binary doesn't own the file buffer
It is now just a wrapper, which simplifies using object::Binary with other
users of the underlying file.
IR in object files is now supported
@@ -318,7 +320,7 @@ The new implementation is also lazier and has a ``save-temps`` option.
Change in the representation of lazy loaded funcs
-Lazy loaded functions are now represented is a way that ``isDeclaration``
+Lazy loaded functions are now represented in a way that ``isDeclaration``
returns the correct answer even before reading the body.
@@ -333,10 +335,11 @@ Python 2.7 is now required
This was done to simplify compatibility with python 3.
The leak detector has been removed
-In practice tools like asan and valgrind were finding way more bugs than
+In practice, tools like asan and valgrind were finding way more bugs than
the old leak detector, so it was removed.
@@ -351,12 +354,25 @@ The syntax of comdats was changed to
@g = global i32 0, comdat($c)
@c = global i32 0, comdat
-The version without the parentheses is a syntatic sugar for a comdat with
+The version without the parentheses is a syntactic sugar for a comdat with
the same name as the global.
-Diagnotic infrastructure used by lib/Linker and lib/Bitcode
+Added support for Win64 unwind information
+LLVM now obeys the `Win64 prologue and epilogue conventions
+<https://msdn.microsoft.com/en-us/library/tawsa7cb.aspx>`_ documented by
+Microsoft. Unwind information is also emitted into the .xdata section.
+As a result of the ABI-required prologue changes, it is now no longer possible
+to unwind the stack using a standard frame pointer walk on Win64. Instead,
+users should call ``CaptureStackBackTrace``, or implement equivalent
+functionality by consulting the unwind tables present in the binary.
+Diagnostic infrastructure used by lib/Linker and lib/Bitcode
These libraries now use the diagnostic handler to print errors and warnings.
This provides better error messages and simpler error handling.
@@ -367,12 +383,27 @@ The PreserveSource linker mode was removed
It was fairly broken and was removed.
+The mode is currently still available in the C API for source
+compatibility, but it doesn't have any effect.
-Changes to the ARM Backend
+Garbage Collection
+A new experimental mechanism for describing a garbage collection safepoint was
+added to LLVM. The new mechanism was not complete at the point this release
+was branched so it is recommended that anyone interested in using this
+mechanism track the ongoing development work on tip of tree. The hope is that
+these intrinsics will be ready for general use by 3.7. Documentation can be
+found `here <http://llvm.org/docs/Statepoints.html>`_.
+The existing gc.root implementation is still supported and as fully featured
+as it ever was. However, two features from GCStrategy will likely be removed
+in the 3.7 release (performCustomLowering and findCustomSafePoints). If you
+have a use case for either, please mention it on llvm-dev so that it can be
+considered for future development.
- During this release ...
+We are expecting to migrate away from gc.root in the 3.8 time frame,
+but both mechanisms will be supported in 3.7.
Changes to the MIPS Target
@@ -385,6 +416,7 @@ compile the Linux kernel for 32-bit targets. Additionally, LLD now supports
microMIPS for the O32 ABI on little endian targets, and code generation for
microMIPS is almost completely passing the test-suite.
@@ -417,6 +449,7 @@ few notable ones:
has been fixed when the fastcc calling convention is used with 64-bit FPU's
and -mno-odd-spreg.
@@ -433,6 +466,7 @@ number of kernel patches. See the `LLVMLinux project
* Added support for a number of directives used by Linux to the Integrated
@@ -449,6 +483,7 @@ Miscellaneous
is in use and will be removed in LLVM 3.7. These names have never been
supported by the GNU Assembler for these ABI's.
Changes to the PowerPC Target
@@ -459,7 +494,7 @@ There are numerous improvements to the PowerPC target in this release:
* LLVM now has a POWER8 instruction scheduling description.
-* Address Sanitizer (ASAN) support is now fully functional.
+* AddressSanitizer (ASan) support is now fully functional.
* Performance of simple atomic accesses has been greatly improved.
@@ -470,8 +505,11 @@ There are numerous improvements to the PowerPC target in this release:
* PPC32 SVR4 now supports small-model PIC.
+* Experimental support for the stackmap/patchpoint intrinsics has been added.
* There have been many smaller bug fixes and performance improvements.
Changes to the OCaml bindings
@@ -498,6 +536,14 @@ Changes to the OCaml bindings
* As usual, many more functions have been exposed to OCaml.
+Go bindings
+* A set of Go bindings based on `gollvm <https://github.com/go-llvm/llvm>`_
+ was introduced in this release.
External Open Source Projects Using LLVM 3.6
@@ -505,6 +551,7 @@ An exciting aspect of LLVM is that it is used as an enabling technology for
a lot of other language and tools projects. This section lists some of the
projects that have already been updated to work with LLVM 3.6.
Portable Computing Language (pocl)
@@ -517,6 +564,7 @@ statically parallelize multiple work-items with the kernel compiler, even in
the presence of work-group barriers. This enables static parallelization of
the fine-grained static concurrency in the work groups in multiple ways.
TTA-based Co-design Environment (TCE)
@@ -535,11 +583,12 @@ new LLVM-based code generators "on the fly" for the designed processors and
loads them in to the compiler backend as runtime libraries to avoid
per-target recompilation of larger parts of the compiler chain.
`Likely <http://www.liblikely.org>`_ is an embeddable just-in-time Lisp for
-image recognition and heterogenous computing. Algorithms are just-in-time
+image recognition and heterogeneous computing. Algorithms are just-in-time
compiled using LLVM's MCJIT infrastructure to execute on single or
multi-threaded CPUs and potentially OpenCL SPIR or CUDA enabled GPUs.
Likely seeks to explore new optimizations for statistical learning
@@ -547,6 +596,7 @@ algorithms by moving them from an offline model generation step to the
compile-time evaluation of a function (the learning algorithm) with constant
arguments (the training data).
LDC - the LLVM-based D compiler
@@ -562,6 +612,25 @@ x86/x86_64 systems like Linux, OS X, FreeBSD and Windows and also Linux on
PowerPC (32/64 bit). Ports to other architectures like ARM, AArch64 and MIPS64
are underway.
+LLVMSharp & ClangSharp
+`LLVMSharp <http://www.llvmsharp.org>`_ and
+`ClangSharp <http://www.clangsharp.org>`_ are type-safe C# bindings for
+Microsoft.NET and Mono that Platform Invoke into the native libraries.
+ClangSharp is self-hosted and is used to generated LLVMSharp using the
+`LLVMSharp Kaleidoscope Tutorials <http://www.llvmsharp.org/Kaleidoscope/>`_
+are instructive examples of writing a compiler in C#, with certain improvements
+like using the visitor pattern to generate LLVM IR.
+`ClangSharp PInvoke Generator <http://www.clangsharp.org/PInvoke/>`_ is the
+self-hosting mechanism for LLVM/ClangSharp and is demonstrative of using
+LibClang to generate Platform Invoke (PInvoke) signatures for C APIs.
Additional Information
diff --git a/include/llvm-c/Linker.h b/include/llvm-c/Linker.h
index cedde5ea8e3a..a932c6d0f078 100644
--- a/include/llvm-c/Linker.h
+++ b/include/llvm-c/Linker.h
@@ -20,13 +20,21 @@
extern "C" {
+/* Note: LLVMLinkerPreserveSource has no effect. */
+typedef enum {
+ LLVMLinkerDestroySource = 0, /* Allow source module to be destroyed. */
+ LLVMLinkerPreserveSource = 1 /* Preserve the source module. */
+} LLVMLinkerMode;
/* Links the source module into the destination module, taking ownership
* of the source module away from the caller. Optionally returns a
* human-readable description of any errors that occurred in linking.
* OutMessage must be disposed with LLVMDisposeMessage. The return value
* is true if an error occurred, false otherwise. */
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
- unsigned Unused, char **OutMessage);
+ LLVMLinkerMode Mode, char **OutMessage);
#ifdef __cplusplus
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 767d465d1bee..d5170adb36a3 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -1749,7 +1749,7 @@ bool Linker::LinkModules(Module *Dest, Module *Src) {
LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src,
- unsigned Unused, char **OutMessages) {
+ LLVMLinkerMode Mode, char **OutMessages) {
Module *D = unwrap(Dest);
std::string Message;
raw_string_ostream Stream(Message);
diff --git a/test/Bindings/OCaml/linker.ml b/test/Bindings/OCaml/linker.ml
index 1ea0be9d3dc3..0a365ff81487 100644
--- a/test/Bindings/OCaml/linker.ml
+++ b/test/Bindings/OCaml/linker.ml
@@ -45,7 +45,7 @@ let test_linker () =
let m1 = make_module "one"
and m2 = make_module "two" in
- link_modules m1 m2;
+ link_modules m1 m2 Mode.DestroySource;
dispose_module m1;
let m1 = make_module "one"