Commit Graph

24 Commits

Author SHA1 Message Date
Alex Crichton d69b24805b 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]: https://reviews.llvm.org/D42511
2018-03-03 20:21:35 -08:00
Marc-Antoine Perennou 6250a47ea6 make codegen-backends directory name configurable
This allows to parallel-install several versions of rust system-wide
Fixes #48263

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2018-03-02 13:51:02 +01:00
Matthias Krüger 4452446292 fix more typos found by codespell. 2018-02-17 17:38:49 +01:00
kennytm 077979f4a2
Rollup merge of #48015 - o01eg:disableable-installation, r=alexcrichton
Customizable extended tools

This PR adds `build.tools` option to manage installation of extended rust tools.

By default it doesn't change installation. All tools are built and `rls` and `rustfmt` allowed to fail installation.

If some set of tools chosen only those tools are built and installed without any fails allowed.

It solves some slotting issues with extended build enabled: https://bugs.gentoo.org/show_bug.cgi?id=645498
2018-02-10 14:23:57 +08:00
Matthias Krüger 8d8ba812d0 config.toml.example: fix typos.
Most of them were found by codespell: https://github.com/lucasdemarchi/codespell
2018-02-06 13:01:10 +01:00
O01eg 7be8e2fbb3
Add build.tools option to manage installation of extended rust tools. 2018-02-05 20:10:05 +03:00
Mark Simulacrum e1f04c04df Disable ThinLTO for dist builds.
Dist builds should always be as fast as we can make them, and since
those run on CI we don't care quite as much for the build being somewhat
slower. As such, we don't automatically enable ThinLTO on builds for the
dist builders.
2018-02-03 18:38:17 -07:00
Diggory Blake 0e6601f630 Add wasm_syscall feature to build system 2018-01-30 23:22:23 +00:00
Alex Crichton c6daea7c9a rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.

A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.

There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:

* A *second* LLVM submodule was added in this commit. The main LLVM submodule
  will soon start to drift from the Emscripten submodule, but currently they're
  both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
  This is gated behind a `--enable-emscripten` flag to the configure script. By
  default users should neither check out the emscripten submodule nor compile
  it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
  GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
  of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
  platforms, though. All cross-compiled platforms will not be receiving an
  Emscripten backend yet.

This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.

Closes #46819
2018-01-28 18:32:45 -08:00
kennytm 971b1ba42b
Record build and test result of extended tools into toolstates.json. 2017-12-03 18:36:56 +08:00
Alex Crichton 48996f9e75 rustbuild: Enable WebAssembly backend by default
This commit alters how we compile LLVM by default enabling the WebAssembly
backend. This then also adds the wasm32-unknown-unknown target to get compiled
on the `cross` builder and distributed through rustup. Tests are not yet enabled
for this target but that should hopefully be coming soon!
2017-11-25 06:44:35 -08:00
Josh Stone 19714f55ee config.toml: Add stubs for recognized-but-unused install paths
... specifically `datadir`, `infodir`, and `localstatedir`.  These were
already accepted by `configure.py`, but it didn't have any place to put
the values.
2017-10-26 17:23:14 -07:00
Josh Stone 6f33108e4d bootstrap: update and enable the LLVM version-check
While the `config.toml.example` comments say "we automatically check the
version by default," we actually didn't.  That check was badly out of
date, only allowing 3.5, 3.6, or 3.7.  This it now updated to the new
3.9 minimum requirement, and truly enabled by default.
2017-10-16 13:10:16 -07:00
Vadim Petrochenkov 9e0fc5ccd0 rustbuild: Support specifying archiver and linker explicitly 2017-10-15 22:10:07 +03:00
Vadim Petrochenkov b434c84bab cleanup: rustc doesn't use an external archiver 2017-10-09 22:36:08 +03:00
Oliver Schneider f381744d91
Get the miri test suite to run inside the rustc dev environment 2017-09-17 21:40:13 +02:00
Ben Boeckel 04cbf6eece config.toml.example: fix some typos 2017-09-06 18:23:50 -04:00
Jeremy Sorensen fb30dd70ce getting rid of all changes due to this PR thus far, starting from a clean slate 2017-08-28 08:43:35 -07:00
Alex Crichton a9b0a7ba93 rustbuild: Rewrite the configure script in Python
This commit rewrites our ancient `./configure` script from shell into Python.
The impetus for this change is to remove `config.mk` which is just a vestige of
the old makefile build system at this point. Instead all configuration is now
solely done through `config.toml`.

The python script allows us to more flexibly program (aka we can use loops
easily) and create a `config.toml` which is based off `config.toml.example`.
This way we can preserve comments and munge various values as we see fit.

It is intended that the configure script here is a drop-in replacement for the
previous configure script, no functional change is intended. Also note that the
rationale for this is also because our build system requires Python, so having a
python script a bit earlier shouldn't cause too many problems.

Closes #40730
2017-08-27 18:53:30 -07:00
Samuel Holland 4b09dc6e39 Introduce crt_static target option in config.toml
This controls the value of the crt-static feature used when building the
standard library for a target, as well as the compiler itself when that
target is the host.
2017-08-22 16:24:29 -05:00
JeremySorensen 5e472c20aa fix typo in git-ignore comment 2017-08-17 07:26:57 -07:00
JeremySorensen c3b27d5a71 make ignore-git true by default when channel is dev 2017-08-15 18:39:58 -07:00
Mark Simulacrum 40dea65ec2 Add ability to ignore git when building rust.
Some users of the build system change the git sha on every build due to
utilizing git to push changes to a remote server. This allows them to
simply configure that away instead of depending on custom patches to
rustbuild.
2017-08-13 05:15:43 +05:00
Steven Fackler 1126a85e87 Move config.toml.example to the root dir
It's way more discoverable here.
2017-08-11 22:24:25 -07:00