Commit Graph

140 Commits

Author SHA1 Message Date
bors
25b2f48612 Auto merge of #76378 - petrochenkov:lldtest, r=Mark-Simulacrum
rustbuild: Build tests with LLD if `use-lld = true` was passed

Addresses https://github.com/rust-lang/rust/pull/76127#discussion_r479932392.

Our test suite is generally ready to run with an explicitly specified linker (https://github.com/rust-lang/rust/pull/45191),
 so LLD specified with `use-lld = true` works as well.

Only 4 tests fail (on `x86_64-pc-windows-msvc`):
```
ui/panic-runtime/lto-unwind.rs
run-make-fulldeps/debug-assertions
run-make-fulldeps/foreign-exceptions
run-make-fulldeps/test-harness
```
All of them are legitimate issues with LLD (or at least with combination Rust+LLD) and manifest in segfaults on access to TLS (https://github.com/rust-lang/rust/pull/76127#issuecomment-683473325). UPD: These issues are caused by https://github.com/rust-lang/rust/issues/72145 and appear because I had `-Ctarget-cpu=native` set.

UPD: Further commits build tests with LLD for non-MSVC targets and propagate LLD to more places when `use-lld` is enabled.
2020-09-10 10:06:44 +00:00
Tyler Mandry
f09372ab60
Rollup merge of #74787 - petrochenkov:rustllvm, r=cuviper
Move `rustllvm` into `compiler/rustc_llvm`

The `rustllvm` directory is not self-contained, it contains C++ code built by a build script of the `rustc_llvm` crate which is then linked into that crate.
So it makes sense to make `rustllvm` a part of `rustc_llvm` and move it into its directory.
I replaced `rustllvm` with more obvious `llvm-wrapper` as the subdirectory name, but something like `llvm-adapter` would work as well, other suggestions are welcome.

To make things more confusing, the Rust side of FFI functions defined in `rustllvm` can be found in `rustc_codegen_llvm` rather than in `rustc_llvm`. Perhaps they need to be moved as well, but this PR doesn't do that.

The presence of multiple LLVM-related directories in `src` (`llvm-project`, `rustllvm`, `librustc_llvm`, `librustc_codegen_llvm` and their predecessors) historically confused me and made me wonder about their purpose.
With this PR we will have LLVM itself (`llvm-project`), a FFI crate (`rustc_llvm`, kind of `llvm-sys`) and a codegen backend crate using LLVM through the FFI crate (`rustc_codegen_llvm`).
2020-09-09 21:02:24 -07:00
Vadim Petrochenkov
10d3f8a484 Move rustllvm into rustc_llvm 2020-09-09 23:05:43 +03:00
Vadim Petrochenkov
75a2c68fb6 Update comment in config.toml.example 2020-09-08 22:08:25 +03:00
Joshua Nelson
ba664c258d
Codegen defaults come from rustc, not cargo 2020-09-01 13:37:40 -04:00
Joshua Nelson
9f268de644 Address review comments
- Use prettier syntax for codegen-units defaults
- Remove comment about parallelism that only made sense for specific
values of codegen-units
- Be more specific about what `verbose-tests` does
2020-08-31 00:37:50 -04:00
Joshua Nelson
41c13826f8 Mention why you'd want codegen-units = 0 (other than running out of RAM) 2020-08-30 22:40:16 -04:00
Joshua Nelson
d983873cff Document the defaults for codegen-units 2020-08-30 22:35:12 -04:00
Joshua Nelson
3b4a346de7 Fix incorrect wording for verbose-tests
This info was lost in https://github.com/rust-lang/rust/pull/74334.
2020-08-30 22:23:53 -04:00
Josh Triplett
30b7dac745 Set ninja=true by default
Ninja substantially improves LLVM build time. On a 96-way system, using
Make took 248s, and using Ninja took 161s, a 35% improvement.

We already require a variety of tools to build Rust. If someone wants to
build without Ninja (for instance, to minimize the set of packages
required to bootstrap a new target), they can easily set `ninja=false`
in `config.toml`.  Our defaults should help people build Rust (and LLVM)
faster, to speed up development.
2020-08-26 14:55:21 -07:00
Mark Rousskov
e09cca09ac Add option to use the new symbol mangling in rustc/std 2020-08-12 18:42:42 -04:00
Mateusz Mikuła
594f81a2b4 Make rust.use-lld config option work with non MSVC targets 2020-08-03 18:10:37 +02:00
bors
7b3a781937 Auto merge of #73964 - jyn514:sane-defaults, r=Mark-Simulacrum
Improve defaults in x.py

- Make the default stage dependent on the subcommand
- Don't build stage1 rustc artifacts with x.py build --stage 1. If this is what you want, use x.py build --stage 2 instead, which gives you a working libstd.
- Change default debuginfo when debug = true from 2 to 1

I tried to fix CI to use `--stage 2` everywhere it currently has no stage, but I might have missed a spot.
This does not update much of the documentation - most of it is in https://github.com/rust-lang/rustc-dev-guide/ or https://github.com/rust-lang/rust-forge and will need a separate PR.

See individual commits for a detailed rationale of each change.
See also the MCP: https://github.com/rust-lang/compiler-team/issues/326

r? @Mark-Simulacrum , but anyone is free to give an opinion.
2020-07-28 13:56:32 +00:00
Joshua Nelson
01c6256178 Change debuginfo to default to 1 if debug = true is set
From [a conversation in discord](https://discordapp.com/channels/442252698964721669/443151243398086667/719200989269327882):

> Linking seems to consume all available RAM, leading to the OS to swap memory to disk and slowing down everything in the process
Compiling itself doesn't seem to take up as much RAM, and I'm only looking to check whether a minimal testcase can be compiled by rustc, where the runtime performance isn't much of an issue

> do you have debug = true or debuginfo-level = 2 in config.toml?
> if so I think that results in over 2GB of debuginfo nowadays and is likely the culprit
> which might mean we're giving out bad advice :(

Anecdotally, this sped up my stage 1 build from 15 to 10 minutes.

This still adds line numbers, it only removes variable and type information.

- Improve wording for debuginfo description

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-27 23:11:18 -04:00
Ximin Luo
1f25a4b3ae config.toml.example: Update remap-debuginfo doc to be more general & accurate 2020-07-26 23:14:17 +01:00
Joshua Nelson
ba661d829d bootstrap: Improve wording on docs for verbose-tests 2020-07-14 11:11:24 -04:00
Tomasz Miąsko
bcef848a69 Explain effects of debugging options from config.toml
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-05 11:37:39 +02:00
bors
16957bd4d3 Auto merge of #73456 - tmiasko:musl-libdir, r=Mark-Simulacrum
bootstrap: Configurable musl libdir

Make it possible to customize the location of musl libdir using
musl-libdir in config.toml, e.g., to use lib64 instead of lib.
2020-06-30 15:41:50 +00:00
Tshepang Lekhonkhobe
b23baa78dc fix
See b65ea1bef1 (r444376289)
2020-06-24 04:47:20 +02:00
Tshepang Lekhonkhobe
b65ea1bef1 place non-obvious defaults on a separate line
See https://github.com/rust-lang/rust/pull/73538#discussion_r443809593
for the motivation
2020-06-23 00:29:55 +02:00
Tshepang Lekhonkhobe
e84552e5dc be more consistent with "defaults" placement 2020-06-22 17:07:42 +02:00
Tshepang Lekhonkhobe
16e741c8e9 explain the logic a bit 2020-06-20 13:22:13 +02:00
Tshepang Lekhonkhobe
1b47e8fa99 examples should be of type bool 2020-06-20 10:56:47 +02:00
Tomasz Miąsko
5c20ef433b bootstrap: Configurable musl libdir
Make it possible to customize the location of musl libdir using
musl-libdir in config.toml, e.g., to use lib64 instead of lib.
2020-06-18 07:36:22 +02:00
Rich Kadel
1db44afecd Ensure profiling runtime for -Zinstrument-coverage
If config.toml `profiler = false`, the test/mir-opt/instrument_coverage
test is ignored. Otherwise, this patch ensures the profiler_runtime is
loaded when -Zinstrument-coverage is enabled. Confirmed that this works
for MacOS.
2020-06-16 18:48:46 -07:00
Jake Goulding
690bb8af51 [AVR] Add AVR platform support 2020-06-09 17:34:07 +12:00
Tomasz Miąsko
6778c7a7c1 Show default values for debug-assertions & debug-assertions-std 2020-05-20 16:48:45 +02:00
Dylan DPC
24cd42781f
Rollup merge of #72146 - Mark-Simulacrum:separate-std-asserts, r=alexcrichton
Provide separate option for std debug asserts

On local one-off benchmarking of libcore metadata-only, debug asserts in std are a significant hit (15s to 20s). Provide an option for compiler developers to disable them. A build with a nightly compiler is around 10s, for reference.
2020-05-15 01:57:17 +02:00
Mark Rousskov
6c415450fd Provide separate option for std debug asserts 2020-05-12 13:24:07 -04:00
Ralf Jung
dc7524be27 remove lldb package from bootstrap, config and build-manifest
it's not been built since a long time ago
2020-05-10 22:43:58 +02:00
Joshua Nelson
df36ec0b7e x.py: allow configuring the build directory
This allows configuring the directory for build artifacts, instead of having it always be ./build. This means you can set it to a constant location, letting you reuse the same cache while working in several different directories.

The configuration lives in config.toml under build.build-dir. By default, it keeps the existing default of ./build, but it can be configured to any relative or absolute path. Additionally, it allows making outputs relative to the root of the git repository using $ROOT.
2020-05-08 20:33:50 -04:00
bors
d28a46444e Auto merge of #70882 - tmiasko:llvm-version-suffix, r=Mark-Simulacrum
Make LLVM version suffix independent of rustc version on dev channel

Remove rustc version from LLVM version suffix on dev channel,
avoiding the need for full rebuilds when switching between
branches with different LLVM submodule & rustc version.

Note: To avoid full rebuild, on subsequent LLVM submodule update, copy the
current value of `LLVM_VERSION_SUFFIX` from `build/*/llvm/build/CMakeCache.txt`,
to `version-suffix` in `config.toml`.
2020-04-13 07:34:11 +00:00
Guillaume Gomez
38eb369fa4 Enforce Python 3 as much as possible 2020-04-10 09:09:58 -04:00
Tomasz Miąsko
7c5a4cdd66 Make LLVM version suffix independent of rustc version on dev channel
Remove rustc version from LLVM version suffix on dev channel, avoiding
the need for full rebuilds when moving between commits with different
LLVM submodule & rustc version.
2020-04-07 15:03:24 +02:00
Matthias Krüger
136ad015b6 fix various typos 2020-03-06 15:19:31 +01:00
Dylan DPC
c8c2b2bc54
Rollup merge of #68824 - ajpaverd:cfguard-rustbuild, r=Mark-Simulacrum
Enable Control Flow Guard in rustbuild

Now that Rust supports Control Flow Guard (#68180), add a config.toml option to build the standard library with CFG enabled.

r? @nagisa
2020-02-11 16:36:57 +01:00
Andrew Paverd
87df124ba7 Enable Control Flow Guard in rustbuild 2020-02-10 19:26:25 +00:00
John Kåre Alsaker
d304cd0c55 More comments 2020-02-09 14:35:50 +01:00
John Kåre Alsaker
e763ddc6b9 Add some comments 2020-02-09 14:26:13 +01:00
John Kåre Alsaker
bfba6ef328 Add an option to use LLD to link the compiler on Windows platforms 2020-01-29 18:05:36 +01:00
varkor
9ef4fd7e19 Clarify the relationship between extended and tools in config.toml 2020-01-11 13:04:06 +00:00
Yuki Okushi
9dd2c9eae3
Rollup merge of #67636 - semarie:bootstrap-rustfmt, r=Mark-Simulacrum
allow rustfmt key in [build] section

Permit using `rustfmt` in `config.toml`. It will allow to not download `rustfmt` binary, which is not possible for at least some tiers-3 platforms.

Fixes: #67624

r? @Mark-Simulacrum
2020-01-03 17:56:23 +09:00
Michael Woerister
1b7c404d4b bootstrap: Allow for setting the ThinLTO import limit used for compiler the compiler. 2020-01-02 14:06:45 +01:00
Sebastien Marie
98d8326cfc add comment for rustfmt in config.toml.example 2019-12-27 05:32:12 +00:00
Matthew Healy
1a01f97785 Document LLVM skip-rebuild config.toml option 2019-12-26 22:16:41 +00:00
Alex Crichton
7f23e6e8d7
rustc: Link LLVM directly into rustc again
This commit builds on #65501 continue to simplify the build system and
compiler now that we no longer have multiple LLVM backends to ship by
default. Here this switches the compiler back to what it once was long
long ago, which is linking LLVM directly to the compiler rather than
dynamically loading it at runtime. The `codegen-backends` directory of
the sysroot no longer exists and all relevant support in the build
system is removed. Note that `rustc` still supports a dynamically loaded
codegen backend as it did previously, it just no longer supports
dynamically loaded codegen backends in its own sysroot.

Additionally as part of this the `librustc_codegen_llvm` crate now once
again explicitly depends on all of its crates instead of implicitly
loading them through the sysroot. This involved filling out its
`Cargo.toml` and deleting all the now-unnecessary `extern crate`
annotations in the header of the crate. (this in turn required adding a
number of imports for names of macros too).

The end results of this change are:

* Rustbuild's build process for the compiler as all the "oh don't forget
  the codegen backend" checks can be easily removed.
* Building `rustc_codegen_llvm` is much simpler since it's simply
  another compiler crate.
* Managing the dependencies of `rustc_codegen_llvm` is much simpler since
  it's "just another `Cargo.toml` to edit"
* The build process should be a smidge faster because there's more
  parallelism in the main rustc build step rather than splitting
  `librustc_codegen_llvm` out to its own step.
* The compiler is expected to be slightly faster by default because the
  codegen backend does not need to be dynamically loaded.
* Disabling LLVM as part of rustbuild is still supported, supporting
  multiple codegen backends is still supported, and dynamic loading of a
  codegen backend is still supported.
2019-12-11 09:50:11 -05:00
Mazdak Farrokhzad
ee7f9de4c4
Rollup merge of #65408 - guanqun:remove-rust-optimize, r=Mark-Simulacrum
reorder config.toml.example options and add one missing option

r? @Mark-Simulacrum
2019-10-25 06:18:04 +02:00
Guanqun Lu
2f7e3d55c9 add the missing rust.musl-root option in config.toml.example 2019-10-24 23:43:06 +08:00
Guanqun Lu
9adea61777 add a WARNING to rust.optimize option in config.toml.example 2019-10-24 23:41:48 +08:00
Alex Crichton
c7d285b781 Remove src/llvm-emscripten submodule
With #65251 landed there's no need to build two LLVM backends and ship
them with rustc, every target we have now uses the same LLVM backend!

This removes the `src/llvm-emscripten` submodule and additionally
removes all support from rustbuild for building the emscripten LLVM
backend. Multiple codegen backend support is left in place for now, and
this is intended to be an easy 10-15 minute win on CI times by avoiding
having to build LLVM twice.
2019-10-21 13:05:31 -07:00