path: root/config.toml.example
diff options
authorAlex Crichton <>2017-08-26 18:30:12 -0700
committerAlex Crichton <>2018-03-03 20:21:35 -0800
commitd69b24805b5071e5ec9e62d2777a761723644144 (patch)
treef4b8f9d6205f7eb73ddc124457d2bc03f364f292 /config.toml.example
parentAuto merge of #48600 - Mark-Simulacrum:rustbuild-updates-2, r=alexcrichton (diff)
rust: Import LLD for linking wasm objects
This commit imports the LLD project from LLVM to serve as the default linker for the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently removed along with "binaryen linker" support in rustc. Moving to LLD brings with it a number of benefits for wasm code: * LLD is itself an actual linker, so there's no need to compile all wasm code with LTO any more. As a result builds should be *much* speedier as LTO is no longer forcibly enabled for all builds of the wasm target. * LLD is quickly becoming an "official solution" for linking wasm code together. This, I believe at least, is intended to be the main supported linker for native code and wasm moving forward. Picking up support early on should help ensure that we can help LLD identify bugs and otherwise prove that it works great for all our use cases! * Improvements to the wasm toolchain are currently primarily focused around LLVM and LLD (from what I can tell at least), so it's in general much better to be on this bandwagon for bugfixes and new features. * Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which means a postprocessor is no longer needed to show off Rust's "small wasm binary size". LLD is added in a pretty standard way to rustc right now. A new rustbuild target was defined for building LLD, and this is executed when a compiler's sysroot is being assembled. LLD is compiled against the LLVM that we've got in tree, which means we're currently on the `release_60` branch, but this may get upgraded in the near future! LLD is placed into rustc's sysroot in a `bin` directory. This is similar to where `gcc.exe` can be found on Windows. This directory is automatically added to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd` linker which implements the interface that `wasm-ld`, LLD's frontend, expects. Like Emscripten the LLD target is currently only enabled for Tier 1 platforms, notably OSX/Windows/Linux, and will need to be installed manually for compiling to wasm on other platforms. LLD is by default turned off in rustbuild, and requires a `config.toml` option to be enabled to turn it on. Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD has a native option for controlling this. [gc]:
Diffstat (limited to 'config.toml.example')
1 files changed, 4 insertions, 0 deletions
diff --git a/config.toml.example b/config.toml.example
index 3dfd25aade..b47f9163c0 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -329,6 +329,10 @@
329# target, as without this option the test output will not be captured. 329# target, as without this option the test output will not be captured.
330#wasm-syscall = false 330#wasm-syscall = false
331 331
332# Indicates whether LLD will be compiled and made available in the sysroot for
333# rustc to execute.
334#lld = false
332# ============================================================================= 336# =============================================================================
333# Options for specific targets 337# Options for specific targets
334# 338#