[llvm-branch-commits] [llvm-branch] r230431 - Revert 224782: "Finish removing DestroySource."
Hans Wennborg
hans at hanshq.net
Tue Feb 24 18:00:21 PST 2015
Author: hans
Date: Tue Feb 24 20:00:21 2015
New Revision: 230431
URL: http://llvm.org/viewvc/llvm-project?rev=230431&view=rev
Log:
Revert 224782: "Finish removing DestroySource."
Filip Pizlo pointed out that this changes the C API.
It's too late in the release process to figure out how we want to
handle this. Reverting the patch is essentially a way of buying time:
we don't change the API at the source level for now, we're not
trying to fix it with a last-minute patch with a risk of unintended
effects, and we preserve our options for fixing this in 3.6.1.
This is not ideal, but I think it's the best compromise at this stage.
Modified:
llvm/branches/release_36/bindings/go/llvm/linker.go
llvm/branches/release_36/bindings/ocaml/linker/linker_ocaml.c
llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.ml
llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.mli
llvm/branches/release_36/docs/ReleaseNotes.rst
llvm/branches/release_36/include/llvm-c/Linker.h
llvm/branches/release_36/lib/Linker/LinkModules.cpp
llvm/branches/release_36/test/Bindings/OCaml/linker.ml
Modified: llvm/branches/release_36/bindings/go/llvm/linker.go
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/bindings/go/llvm/linker.go?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/bindings/go/llvm/linker.go (original)
+++ llvm/branches/release_36/bindings/go/llvm/linker.go Tue Feb 24 20:00:21 2015
@@ -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))
C.LLVMDisposeMessage(cmsg)
Modified: llvm/branches/release_36/bindings/ocaml/linker/linker_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/bindings/ocaml/linker/linker_ocaml.c?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/bindings/ocaml/linker/linker_ocaml.c (original)
+++ llvm/branches/release_36/bindings/ocaml/linker/linker_ocaml.c Tue Feb 24 20:00:21 2015
@@ -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;
Modified: llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.ml?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.ml (original)
+++ llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.ml Tue Feb 24 20:00:21 2015
@@ -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
+end
+
+external link_modules : Llvm.llmodule -> Llvm.llmodule -> Mode.t -> unit
= "llvm_link_modules"
Modified: llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.mli?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.mli (original)
+++ llvm/branches/release_36/bindings/ocaml/linker/llvm_linker.mli Tue Feb 24 20:00:21 2015
@@ -14,6 +14,13 @@
exception Error of string
+(** Linking mode. *)
+module Mode : sig
+ type t =
+ | DestroySource
+ | PreserveSource
+end
+
(** [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
Modified: llvm/branches/release_36/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/docs/ReleaseNotes.rst?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/docs/ReleaseNotes.rst (original)
+++ llvm/branches/release_36/docs/ReleaseNotes.rst Tue Feb 24 20:00:21 2015
@@ -383,6 +383,9 @@ The PreserveSource linker mode was remov
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.
+
Garbage Collection
------------------
Modified: llvm/branches/release_36/include/llvm-c/Linker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/include/llvm-c/Linker.h?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/include/llvm-c/Linker.h (original)
+++ llvm/branches/release_36/include/llvm-c/Linker.h Tue Feb 24 20:00:21 2015
@@ -20,13 +20,21 @@
extern "C" {
#endif
+
+/* 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
}
Modified: llvm/branches/release_36/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Linker/LinkModules.cpp?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Linker/LinkModules.cpp (original)
+++ llvm/branches/release_36/lib/Linker/LinkModules.cpp Tue Feb 24 20:00:21 2015
@@ -1749,7 +1749,7 @@ bool Linker::LinkModules(Module *Dest, M
//===----------------------------------------------------------------------===//
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);
Modified: llvm/branches/release_36/test/Bindings/OCaml/linker.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/test/Bindings/OCaml/linker.ml?rev=230431&r1=230430&r2=230431&view=diff
==============================================================================
--- llvm/branches/release_36/test/Bindings/OCaml/linker.ml (original)
+++ llvm/branches/release_36/test/Bindings/OCaml/linker.ml Tue Feb 24 20:00:21 2015
@@ -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"
More information about the llvm-branch-commits
mailing list