From 90a9f65b8da62f7495e56cab252efe590dd456e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Tue, 17 Jun 2014 18:34:50 +0200 Subject: [PATCH] Update LLVM To fix #8106, we need an LLVM version that contains r211082 aka 0dee6756 which fixes a bug that blocks that issue. There have been some tiny API changes in LLVM, and cmpxchg changed its return type. The i1 part of the new return type is only interesting when using the new weak cmpxchg, which we don't do. --- src/librustc/middle/trans/intrinsic.rs | 8 ++++++-- src/llvm | 2 +- src/rustllvm/RustWrapper.cpp | 12 ++++++++++-- src/rustllvm/llvm-auto-clean-trigger | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index 648a2c335e6..7624a71c9dd 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -235,11 +235,15 @@ pub fn trans_intrinsic(ccx: &CrateContext, lib::llvm::SequentiallyConsistent => lib::llvm::SequentiallyConsistent, }; - let old = AtomicCmpXchg(bcx, get_param(decl, first_real_arg), + let res = AtomicCmpXchg(bcx, get_param(decl, first_real_arg), get_param(decl, first_real_arg + 1u), get_param(decl, first_real_arg + 2u), order, strongest_failure_ordering); - Ret(bcx, old); + if unsafe { lib::llvm::llvm::LLVMVersionMinor() >= 5 } { + Ret(bcx, ExtractValue(bcx, res, 0)); + } else { + Ret(bcx, res); + } } "load" => { let old = AtomicLoad(bcx, get_param(decl, first_real_arg), diff --git a/src/llvm b/src/llvm index 0a894645cf1..1bba09755d9 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 0a894645cf120539876e9eb4eb0d7b572dfa9d14 +Subproject commit 1bba09755d95892bc826c558630e93803b0a4ee6 diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index f42844b9f19..a1a88d1b14d 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -659,7 +659,7 @@ LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) { extern "C" void* LLVMRustOpenArchive(char *path) { std::unique_ptr buf; - error_code err = MemoryBuffer::getFile(path, buf); + std::error_code err = MemoryBuffer::getFile(path, buf); if (err) { LLVMRustSetLastError(err.message().c_str()); return NULL; @@ -694,14 +694,18 @@ LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) { #if LLVM_VERSION_MINOR >= 5 Archive::child_iterator child = ar->child_begin(), end = ar->child_end(); + for (; child != end; ++child) { + ErrorOr name_or_err = child->getName(); + if (name_or_err.getError()) continue; + StringRef sect_name = name_or_err.get(); #else Archive::child_iterator child = ar->begin_children(), end = ar->end_children(); -#endif for (; child != end; ++child) { StringRef sect_name; error_code err = child->getName(sect_name); if (err) continue; +#endif if (sect_name.trim(" ") == name) { StringRef buf = child->getBuffer(); *size = buf.size(); @@ -757,7 +761,11 @@ inline section_iterator *unwrap(LLVMSectionIteratorRef SI) { extern "C" int LLVMRustGetSectionName(LLVMSectionIteratorRef SI, const char **ptr) { StringRef ret; +#if LLVM_VERSION_MINOR >= 5 + if (std::error_code ec = (*unwrap(SI))->getName(ret)) +#else if (error_code ec = (*unwrap(SI))->getName(ret)) +#endif report_fatal_error(ec.message()); *ptr = ret.data(); return ret.size(); diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger index 4e599ad115d..1bd3434b46e 100644 --- a/src/rustllvm/llvm-auto-clean-trigger +++ b/src/rustllvm/llvm-auto-clean-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be forcibly cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2014-05-20 +2014-06-20.2