Skip to content

Upgrade LLVM #11853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,10 @@ do
LLVM_OPTS="$LLVM_OPTS --disable-terminfo"
# Try to have LLVM pull in as few dependencies as possible (#9397)
LLVM_OPTS="$LLVM_OPTS --disable-zlib --disable-libffi"
# LLVM says it needs a "new" clang/gcc, but we seem to get by ok with
# older versions on the bots. Get by for a little longer by asking it to
# not do version detection
LLVM_OPTS="$LLVM_OPTS --disable-compiler-version-checks"

# Use win32 native thread/lock apis instead of pthread wrapper.
# (llvm's configure tries to find pthread first, so we have to disable it explicitly.)
Expand Down
2 changes: 2 additions & 0 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,8 @@ pub mod llvm {
pub fn LLVMRustArchiveReadSection(AR: ArchiveRef, name: *c_char,
out_len: *mut size_t) -> *c_char;
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);

pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2531,12 +2531,12 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
llvm::LLVMAddGlobal(llmod, maptype.to_ref(), buf)
}
});
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);

// On windows we'd like to export the toplevel cratemap
// such that we can find it from libstd.
if targ_cfg.os == OsWin32 && is_top {
lib::llvm::SetLinkage(map, lib::llvm::DLLExportLinkage);
} else {
lib::llvm::SetLinkage(map, lib::llvm::ExternalLinkage);
unsafe { llvm::LLVMRustSetDLLExportStorageClass(map) }
}

return (sym_name, map);
Expand Down
2 changes: 1 addition & 1 deletion src/llvm
Submodule llvm updated 1406 files
2 changes: 1 addition & 1 deletion src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
std::string ErrorInfo;
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_Binary);
formatted_raw_ostream FOS(OS);
PM->add(createPrintModulePass(&FOS));
PM->add(createPrintModulePass(FOS));
PM->run(*unwrap(M));
}

Expand Down
20 changes: 13 additions & 7 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,15 @@ extern "C" bool
LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
Module *Dst = unwrap(dst);
MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
std::string Err;
Module *Src = llvm::getLazyBitcodeModule(buf, Dst->getContext(), &Err);
if (Src == NULL) {
LLVMRustError = Err.c_str();
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext());
if (!Src) {
LLVMRustError = Src.getError().message().c_str();
delete buf;
return false;
}

if (Linker::LinkModules(Dst, Src, Linker::DestroySource, &Err)) {
std::string Err;
if (Linker::LinkModules(Dst, *Src, Linker::DestroySource, &Err)) {
LLVMRustError = Err.c_str();
return false;
}
Expand All @@ -570,8 +570,8 @@ LLVMRustOpenArchive(char *path) {

extern "C" const char*
LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
for (Archive::child_iterator child = ar->begin_children(),
end = ar->end_children();
for (Archive::child_iterator child = ar->child_begin(),
end = ar->child_end();
child != end; ++child) {
StringRef sect_name;
error_code err = child->getName(sect_name);
Expand All @@ -589,3 +589,9 @@ extern "C" void
LLVMRustDestroyArchive(Archive *ar) {
delete ar;
}

extern "C" void
LLVMRustSetDLLExportStorageClass(LLVMValueRef Value) {
GlobalValue *V = unwrap<GlobalValue>(Value);
V->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
}
2 changes: 1 addition & 1 deletion src/rustllvm/llvm-auto-clean-trigger
Original file line number Diff line number Diff line change
@@ -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-01-22
2014-01-27
4 changes: 1 addition & 3 deletions src/rustllvm/rustllvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
#include "llvm/PassManager.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/Lint.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Timer.h"
Expand Down