Commit graph

186 commits

Author SHA1 Message Date
David Wood e552c0d86b bootstrap: add config option for nix patching
On NixOS systems, bootstrap will patch rustc used in bootstrapping after
checking `/etc/os-release` (to confirm the current distribution is NixOS).
However, when using Nix on a non-NixOS system, it can be desirable for
bootstrap to patch rustc. In this commit, a `patch-binaries-for-nix`
option is added to `config.toml`, which allows for user opt-in to
bootstrap's Nix patching.

Signed-off-by: David Wood <david.wood@huawei.com>
2021-10-02 20:01:43 +00:00
John Paul Adrian Glaubitz df7ad3af21 bootstrap: Add LLVM target matching for M68k 2021-09-17 15:07:12 +00:00
Manuel Drehwald 8f6827ffb7 add two new build flags to build clang and enable llvm plugins 2021-07-31 23:14:54 +02:00
Adam Gemmell 24254d693b Fix download-ci-llvm help comment 2021-07-16 15:29:10 +01:00
Alexander Melentyev e84c9aed6d Delete spaces 2021-06-21 12:11:37 +03:00
bors f434217aab Auto merge of #79608 - alessandrod:bpf, r=nagisa
BPF target support

This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker.

I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-06 01:02:32 +00:00
Alessandro Decina 0adb9331ff BPF: review fixes 2021-05-30 11:57:00 +10:00
12101111 52a33655be
cleanup and fix compiling of libunwind
fix conditional compiling of llvm-libunwind feaure for musl target.
update document of llvm-libunwind feature.
2021-05-26 19:22:58 +08:00
Alessandro Decina cf5ac6228c Add BPF target to config.toml.example 2021-05-23 18:03:27 +10:00
Joshua Nelson 506031fc78 Remove outdated FIXME for download-rustc 2021-05-09 12:24:59 -04:00
bors 361bfce305 Auto merge of #82451 - jyn514:defaults, r=Mark-Simulacrum
Cleanup option parsing and config.toml.example

- Add an assertion that `link-shared = true` when `thin-lto = true`.
  Previously, link-shared would be silently overwritten.

- Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults
  immediately instead of delaying until later in bootstrap. This makes
  it easier to find what the default value is.

- Remove redundant `config.x = false` when the default was already false
- Set defaults for `bindir` in `default_opts()` instead of `parse()`
- Update `download-ci-llvm = if-supported` option to match bootstrap.py
- Remove redundant check for link_shared. Previously, it was checked twice.

- Update various options in config.toml.example to their defaults.
  Previously, some options showed an example value instead of the
  default value.

- Fix incorrect defaults in config.toml.example
  + `use-libcxx` defaults to false
  + Add missing `check-stage = 0`
  + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`)

- Remove redundant defaults in prose
- Use the same comment for the default and target-dependent `musl-root`
- Fix typos
- Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated.
- Update more defaults to better reflect how they actually get set
- Remove ignored `gpg-password-file` option

  This stopped being used in
  7704d35,
  but was never removed from config.toml.

- Remove unused flags from `config.toml`
    + Disallow `infodir` and `localstatedir` in `config.toml`
    + Allow the flags in `./configure`, but give a warning that they will be
      ignored.
    + Fix incorrect comment that `datadir` will be ignored.

    Example output:

    ```
    $ ./configure --set install.infodir=xxx
    configure: processing command line
    configure:
    configure: install.infodir      := xxx
    configure: build.configure-args := ['--set', 'install.infodir=xxx']
    warning: infodir will be ignored
    configure:
    configure: writing `config.toml` in current directory
    configure:
    configure: run `python /home/joshua/rustc3/x.py --help`
    configure:
    ```

- Update CHANGELOG

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/bootstrap.20defaults
2021-04-07 20:44:37 +00:00
Joshua Nelson 28e83a4716 Cleanup option parsing and config.toml.example
- Add an assertion that `link-shared = true` when `thin-lto = true`.
  Previously, link-shared would be silently overwritten.

- Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults
  immediately instead of delaying until later in bootstrap. This makes
  it easier to find what the default value is.

- Remove redundant `config.x = false` when the default was already false
- Set defaults for `bindir` in `default_opts()` instead of `parse()`
- Update `download-ci-llvm = if-supported` option to match bootstrap.py
- Remove redundant check for link_shared. Previously, it was checked twice.

- Update various options in config.toml.example to their defaults.
  Previously, some options showed an example value instead of the
  default value.

- Fix incorrect defaults in config.toml.example
  + `use-libcxx` defaults to false
  + Add missing `check-stage = 0`
  + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`)

- Remove redundant defaults in prose
- Use the same comment for the default and target-dependent `musl-root`
- Fix typos
- Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated.
- Update more defaults to better reflect how they actually get set
- Remove ignored `gpg-password-file` option

  This stopped being used in
  7704d35acc,
  but was never removed from config.toml.

- Remove unused flags from `config.toml`
    + Disallow `infodir` and `localstatedir` in `config.toml`
    + Allow the flags in `./configure`, but give a warning that they will be
      ignored.
    + Fix incorrect comment that `datadir` will be ignored.

    Example output:

    ```
    $ ./configure --set install.infodir=xxx
    configure: processing command line
    configure:
    configure: install.infodir      := xxx
    configure: build.configure-args := ['--set', 'install.infodir=xxx']
    warning: infodir will be ignored
    configure:
    configure: writing `config.toml` in current directory
    configure:
    configure: run `python /home/joshua/rustc3/x.py --help`
    configure:
    ```

- Update CHANGELOG
- Add "as an example" where appropriate
- Link to an issue instead of to ephemeral chats
2021-04-07 14:36:02 -04:00
Dylan DPC 335a3c4b7f
Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

This sets `BOOTSTRAP_DOWNLOAD_RUSTC` in bootstrap.py so rustbuild doesn't have to try and replicate its logic.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum` cc `@camelid`
2021-04-05 15:48:40 +02:00
Joshua Nelson 580a740bdd Add download-rustc = "if-unchanged"
This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.
2021-04-05 09:46:43 -04:00
Rich Kadel 23325caf43 Make rust-demangler installable
Adds bootstrap rules to support installing rust-demangler.

When compiling with `-Z instrument-coverage`, the coverage reports are
generated by `llvm-cov`. `llvm-cov` includes a built-in demangler for
C++, and an option to supply an alternate demangler. For Rust, we have
`rust-demangler`, currently used in `rustc` coverage tests.

Fuchsia's toolchain for Rust is built via `./x.py install`. Fuchsia is
adding support for Rust coverage, and we need to include the
`rust-demangler` in the installed `bin` directory.

Configured rust-demangler as an in-tree extended tool.

Added tests to support `./x.py test rust-demangler`.

Install with extended tools by default only if `profiler = true`.
2021-04-03 11:42:54 -07:00
Michael Howell fdb3e820b1 Add a disable-minification option for rustdoc
This way, you can debug rustdoc's JavaScript and CSS file
with normal F12 Dev Tools and you'll have useful line numbers
to work with.
2021-03-12 12:25:16 -07:00
Joshua Nelson c8825d0400
Rollup merge of #82360 - osa1:issue82317, r=Mark-Simulacrum
config.toml parsing error improvements

Improve error messages for musl-libdir and wasi-root keys. Previously
the parser would panic with `unwrap()`. Now it prints

      Target "wasm32-wasi" does not have a "wasi-root" key

(and similar for the `musl-libdir` field, which is used in target that
use musl)

Also update comments around wasi-root field to make it clear that the
field is only valid in wasm32-wasi target and needs to be moved to a
`[target.wasm32-wasi]` section to be valid.

Fixes #82317

---

r? `@Mark-Simulacrum`
2021-03-01 11:25:03 -05:00
Ömer Sinan Ağacan 81cfa98f82 config.toml error reporting:
Improve error messages for musl-libdir and wasi-root keys. Previously
the parser would panic with `unwrap()`. Now it prints

      Target "wasm32-wasi" does not have a "wasi-root" key

(and similar for the `musl-libdir` field, which is used in target that
use musl)

Also update comments around wasi-root field to make it clear that the
field is only valid in wasm32-wasi target and needs to be moved to a
`[target.wasm32-wasi]` section to be valid.

Fixes #82317
2021-03-01 09:24:08 +03:00
Felix S. Klock II 0d8bf72a36 Created experimental build.print_step_rusage setting
Intended to piggy-back on output from existing build.print_step_timings setting.
2021-02-25 11:38:51 -05:00
Joshua Nelson 6457845219 Absolute bare minimum for downloading rustc from CI
- Use the same compiler for stage0 and stage1. This should be fixed at
  some point (so bootstrap isn't constantly rebuilt).
- Make sure `x.py build` and `x.py check` work.
- Use `git merge-base` to determine the most recent commit to download.
- Copy stage0 to the various sysroots in `Sysroot`, and delegate to
  Sysroot in Assemble. Leave all other code unchanged.
- Rename date -> key

  This can also be a commit hash, so 'date' is no longer a good name.

- Add the commented-out option to config.toml.example
- Disable all steps by default when `download-rustc` is enabled

  Most steps don't make sense when downloading a compiler, because they'll
  be pre-built in the sysroot. Only enable the ones that might be useful,
  in particular Rustdoc and all `check` steps.

  At some point, this should probably enable other tools, but rustdoc is
  enough to test out `download-rustc`.

- Don't print 'Skipping' twice in a row

  Bootstrap forcibly enables a dry run if it isn't already set, so
  previously it would print the message twice:

  ```
  Skipping bootstrap::compile::Std because it is not enabled for `download-rustc`
  Skipping bootstrap::compile::Std because it is not enabled for `download-rustc`
  ```

  Now it correctly only prints once.

 ## Future work

- Add FIXME about supporting beta commits
- Debug logging will never work. This should be fixed.
2021-02-08 23:15:36 -05:00
Joshua Nelson 5c4adbe1e1 Add all tier 1 platforms to supported platforms for "if-available"
... and update the comment in `config.toml.example`
2021-01-15 22:08:47 -05:00
Pietro Albini 0a2034dca4
bootstrap: add the dist.compression-formats option
The option allows to add or remove compression formats used while
producing dist tarballs.
2020-12-29 11:56:25 +01:00
J. Ryan Stinnett e628fcfcb5 Skip dsymutil by default for compiler bootstrap
`dsymutil` adds time to builds on Apple platforms for no clear benefit, and also
makes it more difficult for debuggers to find debug info. The compiler currently
defaults to running `dsymutil` to preserve its historical default, but when
compiling the compiler itself, we skip it by default since we know it's safe to
do so in that case.
2020-12-20 02:55:35 +00:00
Josh Stone 5f08568042 x.py: allow a custom string appended to the version
This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
2020-11-16 14:08:21 -08:00
Jonas Schievink 194b96852f
Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum
Support enable/disable sanitizers/profiler per target

This PR add options under `[target.*]` of `config.toml` which can enable or disable sanitizers/profiler runtime for corresponding target.
If these options are empty, the global options under `[build]` will take effect.

Fix #78329
2020-11-11 20:58:56 +01:00
Joseph Rafael Ferrer 301bb123f4 Enable LLVM Polly via llvm-args. 2020-10-30 18:23:02 +08:00
Yuki Okushi 2c307fab49
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
add system-llvm-libunwind config option

allows using the system-wide llvm-libunwind as the unwinder

Workaround for #76020
2020-10-27 08:44:44 +09:00
bjorn3 cf798c1ec6 Add support for using cg_clif to bootstrap rustc 2020-10-26 09:52:59 +01:00
12101111 b989d46b48 Support enable/disable sanitizers/profiler per target 2020-10-26 10:34:07 +08:00
Marc-Antoine Perennou 66fa42a946 allow using the system-wide llvm-libunwind as the unwinder
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-10-21 14:45:58 +02:00
Yuki Okushi c98b3e86c0
Rollup merge of #77787 - jyn514:consistent-versions, r=spastorino
Update `changelog-seen` in config.toml.example

This got out of sync when the version was bumped last time in #77133

Long-term we may want to find an easier way to maintain this that
doesn't require bumping the version in three different places. Off the
top of my head I can't think of anything, though. It _is_ documented in src/bootstrap/README.md, although I don't know how many people read that.

r? @Mark-Simulacrum
cc @spastorino
2020-10-11 03:19:21 +09:00
Yuki Okushi 2224e26578 Clarify the debug-related values should take boolean
They should take boolean values and the current placeholders are confusing, at least for me.
2020-10-10 23:36:55 +09:00
Joshua Nelson d2ca0c4c9b Update changelog-seen in config.toml.example
This got out of sync when the version was bumped last time.

Long-term we may want to find an easier way to maintain this that
doesn't require bumping the version in three different places. Off the
top of my head I can't think of anything, though.
2020-10-10 10:08:36 -04:00
Joshua Nelson a28f425ad7 Make max_log_info easily greppable 2020-10-08 09:16:27 -04:00
Mark Rousskov ef95430b9b Adjust support expectations for downloaded LLVMs 2020-09-23 19:05:11 -04:00
Joshua Nelson fe6fc555ac Add a changelog for x.py
- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added
2020-09-21 09:08:18 -04:00
Joshua Nelson c9c8fb88cf Add sample defaults for config.toml
- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`
- Add default config files
- Combine config files using the merge dependency.
- Add comments to default config files
- Add a README asking to open an issue if the defaults are bad
- Give a loud error if trying to merge `.target`, since it's not
  currently supported
- Use an exhaustive match
- Use `<none>` in config.toml.example to avoid confusion
- Fix bugs in `Merge` derives

Previously, it would completely ignore the profile defaults if there
were any settings in `config.toml`. I sent an email to the `merge` maintainer
asking them to make the behavior in this commit the default.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.
2020-09-20 16:18:58 -04:00
bors 1e11660d1e Auto merge of #76625 - jyn514:default-stages, r=Mark-Simulacrum
Make the default stage for x.py configurable

This also allows configuring each sub-command individually.

Possibly #76617 should land before this? I don't feel strongly either way, I don't mind waiting.

Closes https://github.com/rust-lang/rust/issues/76165.
r? `@Mark-Simulacrum`
2020-09-16 04:05:22 +00:00
Joshua Nelson 328c61c157 Make the default stage for x.py configurable
This allows configuring the default stage for each sub-command individually.

- Normalize the stage as early as possible, so there's no confusion
  about which to use.
- Don't add an explicit `stage` option in config.toml

  This offers no more flexibility than `*_stage` and makes it confusing
  which takes precedence.

- Always give `--stage N` precedence over config.toml
- Fix bootstrap tests

  This changes the tests to go through `Config::parse` so that they test
  the actual defaults, not the dummy ones provided by `default_opts`.  To
  make this workable (and independent of the environment), it does not
  read `config.toml` for tests.
2020-09-15 11:19:55 -04:00
Jonas Schievink 581524e537
Rollup merge of #76441 - jyn514:parallel, r=jonas-schievink
Note that parallel-compiler = true causes tests to fail

Mentioning #75760.
2020-09-13 20:21:07 +02:00
bors 4e48010b95 Auto merge of #76588 - guswynn:debug_logging, r=jyn514,Mark-Simulacrum
Add a dedicated debug-logging option to config.toml

`@Mark-Simulacrum` and I were talking in zulip and we found that turning on debug/trace logging in rustc is fairly confusing, as it effectively depends on debug-assertions and is not documented as such. `@Mark-Simulacrum` mentioned that we should probably have a separate option for logging anyways.

this diff adds that, having the option follow debug-assertions (so everyone's existing config.toml should be fine) and if the option is false

to test I ran ./x.py test <something> twice, once with `debug-logging = false` and once with `debug-logging = true` and made sure i only saw trace's when it was true
2020-09-13 07:21:31 +00:00
Mark Rousskov a7b092f418 Download LLVM from CI to bootstrap 2020-09-12 15:10:09 -04:00
Gus Wynn 56f5c7f95f comments + add max_level_info so false works with debug_assertions on 2020-09-11 09:01:31 -07:00
Mark Rousskov 78125ec6b3 Stop implicitly appending triples to config.toml hosts and targets
Previously, the CLI --target/--host definitions and configured options differed
in their effect: when setting these on the CLI, only the passed triples would be
compiled for, while in config.toml we would also compile for the build triple
and any host triples. This is needlessly confusing; users expect --target and
--host to be identical to editing the configuration file.

The new behavior is to respect --host and --target when passed as the *only*
configured triples (no triples are implicitly added). The default for --host is
the build triple, and the default for --target is the host triple(s), either
configured or the default build triple.
2020-09-11 08:59:01 -04:00
Gus Wynn 15aa6f31b9 add debug-logging to config.toml 2020-09-10 16:39:04 -07:00
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 44726ba57c Note that parallel-compiler = true causes tests to fail 2020-09-07 07:58:48 -04:00