about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-06-15 08:21:39 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-07-12 23:25:49 +0100
commit4c0c9719678d6a3a7f3cbb7ea6f513bef57180bf (patch)
treec55afe31db057caf64a91ac21b5023b7486cc87c
parent61bea886da83ba071687f7153e896d5dc6a8ef8c (diff)
downloadklee-4c0c9719678d6a3a7f3cbb7ea6f513bef57180bf.tar.gz
llvm38: adapt to new Linker::linkModules
LLVM commit d912be98f8eb changed the prototype of linkModules to accept
std::unique_ptr. Adapt to that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r--lib/Module/ModuleUtil.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index 4f2fdf19..37c957ba 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -159,7 +159,12 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
 static bool linkTwoModules(llvm::Module *Dest,
                            std::unique_ptr<llvm::Module> Src,
                            std::string &errorMsg) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
+
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
+  // Get the potential error message (Src is moved and won't be available later)
+  errorMsg = "Linking module " + Src->getModuleIdentifier() + " failed";
+  auto linkResult = Linker::linkModules(*Dest, std::move(Src));
+#elif LLVM_VERSION_CODE >= LLVM_VERSION(3, 6)
   raw_string_ostream Stream(errorMsg);
   DiagnosticPrinterRawOStream DP(Stream);
   auto linkResult = Linker::LinkModules(