From 7be0b23b691479236580ce4b601f84da2bfe9e94 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 9 Nov 2018 12:54:04 -0800 Subject: [PATCH 1/7] Upgrade to LLVM trunk --- src/libcompiler_builtins | 2 +- src/llvm | 2 +- src/tools/lld | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins index 939cbca6e9d82..fe74674f6e4be 160000 --- a/src/libcompiler_builtins +++ b/src/libcompiler_builtins @@ -1 +1 @@ -Subproject commit 939cbca6e9d829265d6cf006d3532142a4061cd3 +Subproject commit fe74674f6e4be76d47b66f67d529ebf4186f4eb1 diff --git a/src/llvm b/src/llvm index 7051ead40a5f8..21a0c9ebc285d 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 7051ead40a5f825878b59bf08d4e768be9e99a4a +Subproject commit 21a0c9ebc285d794a298e97717abad8d6135fa87 diff --git a/src/tools/lld b/src/tools/lld index 2a9b88b8b419d..1928c5eeb613a 160000 --- a/src/tools/lld +++ b/src/tools/lld @@ -1 +1 @@ -Subproject commit 2a9b88b8b419d094fb2185c0ca31c28d31bdca00 +Subproject commit 1928c5eeb613a4c6d232fc47ae91914bbfd92a79 From ae5b350d7757a70e53219bbb5e32ae149ad063e0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 9 Nov 2018 13:09:32 -0800 Subject: [PATCH 2/7] Handle some renamed ThinLTO functions --- src/rustllvm/PassWrapper.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 3b0046222a95a..06de0d6509bab 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -922,7 +922,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, GlobalValue::LinkageTypes NewLinkage) { ResolvedODR[ModuleIdentifier][GUID] = NewLinkage; }; +#if LLVM_VERSION_GE(8, 0) + thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage); +#else thinLTOResolveWeakForLinkerInIndex(Ret->Index, isPrevailing, recordNewLinkage); +#endif // Here we calculate an `ExportedGUIDs` set for use in the `isExported` // callback below. This callback below will dictate the linkage for all @@ -977,7 +981,11 @@ extern "C" bool LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { Module &Mod = *unwrap(M); const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(Mod.getModuleIdentifier()); +#if LLVM_VERSION_GE(8, 0) + thinLTOResolvePrevailingInModule(Mod, DefinedGlobals); +#else thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals); +#endif return true; } From a43a7a07785fdaca7c04ae2ba2f29512dcca58f4 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Wed, 7 Nov 2018 12:05:54 +0000 Subject: [PATCH 3/7] Make Rustc build with LLVM trunk. --- src/rustllvm/RustWrapper.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index f423503e19fbe..8f7db9e768b01 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -705,10 +705,17 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable( FPVal->getValueAPF().bitcastToAPInt().getZExtValue()); } +#if LLVM_VERSION_GE(8, 0) + llvm::DIGlobalVariableExpression *VarExpr = Builder->createGlobalVariableExpression( + unwrapDI(Context), Name, LinkageName, + unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, + InitExpr, unwrapDIPtr(Decl), nullptr, AlignInBits); +#else llvm::DIGlobalVariableExpression *VarExpr = Builder->createGlobalVariableExpression( unwrapDI(Context), Name, LinkageName, unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, InitExpr, unwrapDIPtr(Decl), AlignInBits); +#endif InitVal->setMetadata("dbg", VarExpr); From bf01bcb451d20d770091acb5cde4a024d91a0740 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Wed, 7 Nov 2018 12:34:43 +0000 Subject: [PATCH 4/7] Conditionally compile in only the extra argument. --- src/rustllvm/RustWrapper.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 8f7db9e768b01..b6e07942f8667 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -705,17 +705,14 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable( FPVal->getValueAPF().bitcastToAPInt().getZExtValue()); } -#if LLVM_VERSION_GE(8, 0) - llvm::DIGlobalVariableExpression *VarExpr = Builder->createGlobalVariableExpression( - unwrapDI(Context), Name, LinkageName, - unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, - InitExpr, unwrapDIPtr(Decl), nullptr, AlignInBits); -#else llvm::DIGlobalVariableExpression *VarExpr = Builder->createGlobalVariableExpression( unwrapDI(Context), Name, LinkageName, unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, - InitExpr, unwrapDIPtr(Decl), AlignInBits); + InitExpr, unwrapDIPtr(Decl), +#if LLVM_VERSION_GE(8, 0) + /* templateParams */ nullptr, #endif + AlignInBits); InitVal->setMetadata("dbg", VarExpr); From c86b1529a5d2141bd61586f9464bcec665830231 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 9 Nov 2018 13:51:00 -0800 Subject: [PATCH 5/7] wasm: Pass `--no-demangle` to LLD Our mangling scheme is not C++'s, so tell LLD to not demangle anything so we can handle Rust-specific demangling ourselves. --- src/librustc_codegen_ssa/back/linker.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index ec5ca5801049e..7e1ea4655fe99 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -1037,6 +1037,11 @@ impl<'a> Linker for WasmLd<'a> { // indicative of bugs, let's prevent them. self.cmd.arg("--fatal-warnings"); + // LLD only implements C++-like demangling, which doesn't match our own + // mangling scheme. Tell LLD to not demangle anything and leave it up to + // us to demangle these symbols later. + self.cmd.arg("--no-demangle"); + ::std::mem::replace(&mut self.cmd, Command::new("")) } From cc9c91d3858332766b7b7aa534fa4d6e2431d4a5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 10 Nov 2018 10:04:17 -0800 Subject: [PATCH 6/7] Pass `--export-dynamic` to LLD for wasm This should handle recent symbol visibility changes happening, although we'll likely want to tweak this in the future! --- src/librustc_codegen_ssa/back/linker.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 7e1ea4655fe99..f3cc344254fea 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -1037,6 +1037,12 @@ impl<'a> Linker for WasmLd<'a> { // indicative of bugs, let's prevent them. self.cmd.arg("--fatal-warnings"); + // The symbol visibility story is a bit in flux right now with LLD. + // It's... not entirely clear to me what's going on, but this looks to + // make everything work when `export_symbols` isn't otherwise called for + // things like executables. + self.cmd.arg("--export-dynamic"); + // LLD only implements C++-like demangling, which doesn't match our own // mangling scheme. Tell LLD to not demangle anything and leave it up to // us to demangle these symbols later. From 7215963e56321c5e92b9c2f7c4ad788362451b37 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 25 Nov 2018 20:28:26 -0800 Subject: [PATCH 7/7] Temporarily disable LLDB --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14fb17aeeddca..fa66220f442c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ matrix: - env: > RUST_CHECK_TARGET=dist - RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler --enable-lldb --set rust.jemalloc" + RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler --set rust.jemalloc" SRC=. DEPLOY_ALT=1 RUSTC_RETRY_LINKER_ON_SEGFAULT=1 @@ -87,7 +87,7 @@ matrix: # OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7. - env: > RUST_CHECK_TARGET=dist - RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-full-tools --enable-profiler --enable-lldb --set rust.jemalloc" + RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-full-tools --enable-profiler --set rust.jemalloc" SRC=. DEPLOY=1 RUSTC_RETRY_LINKER_ON_SEGFAULT=1 @@ -102,7 +102,7 @@ matrix: - env: > RUST_CHECK_TARGET=dist - RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --enable-lldb --set rust.jemalloc" + RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc" SRC=. DEPLOY=1 RUSTC_RETRY_LINKER_ON_SEGFAULT=1