about summary refs log tree commit diff
path: root/src/bootstrap/compile.rs
AgeCommit message (Collapse)AuthorLines
2022-10-21bootstrap: also create rustc-src component in sysrootRalf Jung-0/+14
2022-10-14more dupe word typosRageking8-1/+1
2022-10-07Auto merge of #102025 - chenyukang:fix-102002, r=jyn514bors-2/+10
Delete the stage1 and stage0-sysroot directories when using download-rustc Fixes #102002
2022-10-04use ci-rustc-sysroot for sysroot when download_rustcyukang-1/+3
2022-09-28Make the `c` feature for `compiler-builtins` opt-in instead of inferredJoshua Nelson-5/+10
The build script for `compiler_builtins` doesn't support cross-compilation. I tried fixing it, but the cc crate itself doesn't appear to support cross-compiling to windows either unless you use the -gnu toolchain: ``` error occurred: Failed to find tool. Is `lib.exe` installed? ``` Rather than trying to fix it or special-case the platforms without bugs, make it opt-in instead of automatic.
2022-09-20fix #102002, Delete the stage1 and stage0-sysroot directories when using ↵yukang-2/+8
download-rustc
2022-09-17Revert "fix #101691: copy stage0 binaries into stage0-sysroot"Mark Rousskov-37/+0
This reverts commit 32f8eb2fee4d6781a79052b560abd10e12ebb34f.
2022-09-13fix #101691: copy stage0 binaries into stage0-sysrootyukang-0/+37
2022-09-02Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-SimulacrumMatthias Krüger-1/+3
Change implementation of `-Z gcc-ld` and `lld-wrapper` again This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.
2022-08-12Make `[rust] use-lld=true` work on windowskhyperia-1/+6
Before, it would fail with "error: ignoring unknown argument '-Wl,--icf=all'"
2022-08-06Change implementation of `-Z gcc-ld` and `lld-wrapper` againVadim Petrochenkov-1/+3
2022-07-28Clone the `src/llvm-project` submodule if profiling is enabledNilstrieb-0/+5
To compile rustc with profiling information, `compiler-rt` from LLVM is required. Building it requires the `src/llvm-project` submodule to be initialized and updated.
2022-07-24Revert "Revert "Use ICF (identical code folding) for building rustc""Jubilee Young-0/+6
This reverts commit rust-lang/rust@45575d23f316af7476ccd0a895234ac59c47a6be, thereby enabling identical code folding again.
2022-07-18Revert "Use ICF (identical code folding) for building rustc"Jakub Beránek-6/+0
2022-07-17Use LLD linker for compiling rustc on Linux x64 and use ICF for binary size ↵Jakub Beránek-0/+6
optimization
2022-07-11Auto merge of #96978 - lqd:win_pgo2, r=Mark-Simulacrumbors-2/+31
Utilize PGO for windows x64 rustc dist builds This PR adds PGO support for the CI x64 windows dist builds. These are the results from running the rustc-perf benchmarks: ![image](https://user-images.githubusercontent.com/247183/177662869-683a8034-7c95-42bf-9900-9ffd66677fcf.png) Thanks to `@Kobzol,` `@michaelwoerister,` `@wesleywiser,` `@Mark-Simulacrum` for their precious help.
2022-07-11extend bootstrap for PGO on windowsRémy Rakic-2/+31
When building LLVM/LLD as part of a build that asks LLVM to generate profiles, e.g. when doing PGO, cmake or clang-cl don't automatically link clang's profiler runtime in, causing undefined reference errors at link-time. We do that manually, by adding clang's resource library folder to the library search path: - for LLVM itself, by extending the linker args that `rustc_llvm`'s build script uses, to avoid the linker errors when linking `rustc_driver`. - for LLD, by extending cmake's linker flags during the LLD build step.
2022-07-10Fix `x build library/std compiler/rustc`Joshua Nelson-22/+38
Previously, this was broken because of improper caching: 1. `StepDescription::maybe_run` builds `Compile::Std`, which only built `std` and not `proc_macro` 1. `Std` calls `builder.ensure(StdLink)` 1. `Rustc` calls `ensure(Std)`, which builds all crates, including `proc_macro` 1. `Rustc` calls `ensure(StdLink)`. `ensure` would see that it had already been run and do nothing. <-- bug is here 1. Cargo gives an error that `proc_macro` doesn't exist. This fixes the caching by adding `crates` to `StdLink`, so it will get rerun if the crates that are built change. This also does the same for `RustcLink`; it doesn't matter in practice currently because nothing uses it except `impl Step for Rustc`, but it will avoid bugs if we start using it in the future (e.g. to build individual crates for rustfmt).
2022-07-07Rollup merge of #98994 - kons-9:dont_use_process_exit, r=jyn514Matthias Krüger-2/+2
replace process exit with more detailed exit in src/bootstrap/*.rs Fixes [#98830](https://github.com/rust-lang/rust/issues/98830) I implemeted "detail_exit.rs" in lib.rs, and replace all of std::process::exit. So, error code should panic in test code. ``` // lib.rs pub fn detail_exit(code: i32) -> ! { // Successful exit if code == 0 { std::process::exit(0); } if cfg!(test) { panic!("status code: {}", code); } else { std::panic::resume_unwind(Box::new(code)); } } ``` <details> <summary>% rg "exit\(" src/bootstrap/*.rs</summary> ``` builder.rs 351: crate::detail_exit(1); 1000: crate::detail_exit(1); 1429: crate::detail_exit(1); compile.rs 1331: crate::detail_exit(1); config.rs 818: crate::detail_exit(2); 1488: crate::detail_exit(1); flags.rs 263: crate::detail_exit(exit_code); 349: crate::detail_exit(exit_code); 381: crate::detail_exit(1); 602: crate::detail_exit(1); 616: crate::detail_exit(1); 807: crate::detail_exit(1); format.rs 35: crate::detail_exit(1); 117: crate::detail_exit(1); lib.rs 714: detail_exit(1); 1620: detail_exit(1); 1651:pub fn detail_exit(code: i32) -> ! { 1654: std::process::exit(0); sanity.rs 107: crate::detail_exit(1); setup.rs 97: crate::detail_exit(1); 290: crate::detail_exit(1); test.rs 676: crate::detail_exit(1); 1024: crate::detail_exit(1); 1254: crate::detail_exit(1); tool.rs 207: crate::detail_exit(1); toolstate.rs 96: crate::detail_exit(3); 111: crate::detail_exit(1); 182: crate::detail_exit(1); 228: crate::detail_exit(1); util.rs 339: crate::detail_exit(1); 378: crate::detail_exit(1); 468: crate::detail_exit(1); ``` </details>
2022-07-07squash the commitstoshiki goto-2/+2
implement detail_exit but I'm not sure it is right. not create new file and write detail exit in lib.rs replace std::process::exit to detail_exit that is not related to code runnning. remove pub
2022-07-02Allow building single crates for the compiler and standard libraryJoshua Nelson-14/+63
- Add `Interned<Vec<String>>` and use it for tail args - Refactor `cache.rs` not to need a separate impl for each internable type
2022-06-13Do not try to statically link libstd++ on Solarisgco-0/+1
Fixes: Error on bootstrapping : Empty search path given via '-L' (solaris) #97260
2022-05-29Auto merge of #96687 - jyn514:download-rustc, r=Mark-Simulacrumbors-6/+8
Move download-rustc from python to rustbuild - Remove download-rustc handling from bootstrap.py - Allow a custom `pattern` in `builder.unpack()` - Only download rustc once another part of bootstrap depends on it. This is somewhat necessary since the download functions rely on having a full `Builder`, which isn't available until after config parsing finishes. Helps with https://github.com/rust-lang/rust/issues/94829.
2022-05-25Move download-rustc from bootstrap.py to rustbuildJoshua Nelson-6/+8
- Remove download-rustc handling from bootstrap.py - Allow a custom `pattern` in `builder.unpack()` - Only download rustc once another part of bootstrap depends on it. This is somewhat necessary since the download functions rely on having a full `Builder`, which isn't available until after config parsing finishes.
2022-05-25Simplify implementation of `-Z gcc-ld`Vadim Petrochenkov-8/+5
- The logic is now unified for all targets (wasm targets should also be supported now) - Additional "symlink" files like `ld64` are eliminated - lld-wrapper is used for propagating the correct lld flavor - Cleanup "unwrap or exit" logic in lld-wrapper
2022-05-24Make llvm-libunwind a per-target optionTyler Mandry-1/+1
2022-05-13Add LLVM based mingw-w64 targetsMateusz Mikuła-2/+3
2022-04-27Auto merge of #95170 - jyn514:ci-llvm, r=Mark-Simulacrumbors-1/+1
Move `download-ci-llvm` out of bootstrap.py This is ready for review. It has been tested on Windows, Linux, and NixOS. The second commit ports the changes from https://github.com/rust-lang/rust/pull/95234 to Rust; I can remove it if desired. Helps with https://github.com/rust-lang/rust/issues/94829. As a follow-up, this makes it possible to avoid downloading llvm until it's needed for building `rustc_llvm`; it would be nice to do that, but it shouldn't go in the first draft. It might also be possible to avoid requiring python until tests run (currently there's a check in `sanity.rs`), but I haven't looked too much into that. `@rustbot` label +A-rustbuild
2022-04-24Move download-ci-llvm to rustbuildJoshua Nelson-1/+1
This attempts to keep the logic as close to the original python as possible. `probably_large` has been removed, since it was always `True`, and UTF-8 paths are no longer supported when patching files for NixOS. I can readd UTF-8 support if desired. Note that this required making `llvm_link_shared` computed on-demand, since we don't know whether it will be static or dynamic until we download LLVM from CI.
2022-04-24Rollup merge of #95504 - jyn514:library-alias, r=Mark-SimulacrumMatthias Krüger-2/+2
Add `x {check,build,doc} {compiler,library}` aliases. While working on https://github.com/rust-lang/rust/pull/95503, I realized that it will interfere with existing command lines: Currently people run `x build library/std` expecting it to "add all library crates to the sysroot", but after that change, it will *only* build `libstd` and its dependencies (and add them to the sysroot), not libtest or libproc_macro. That will work for local testing in most cases, but could be confusing. Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. The intended end goal is something like: - For check/build/doc, we have library + compiler aliases, which correspond to basically "most possible" for that piece. This is the intended path of entry (rather than library/test or similar as today) for when you just want the thing to work -- for example, getting a compiler that is "crates.io-compatible" would be roughly `x.py build library`). #95504 - Specific crate invocations build up to that crate, which means that if you don't care about tests you probably want x.py build library/proc_macro or library/std for faster build times. #95503 Note that this is already implemented today for the `doc` command and seems to work pretty well in practice. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged. `@rustbot` label +A-rustbuild
2022-04-10Add `build compiler/rustc_codegen_gcc` as an alias for `CodegenBackend`Joshua Nelson-1/+1
These paths (`_cranelift` and `_gcc`) are somewhat misleading, since they actually tell bootstrap to build *all* codegen backends. But this seems like a useful improvement in the meantime.
2022-03-30Add `x {check,build,doc} {compiler/library}` aliases.Joshua Nelson-2/+2
While working on https://github.com/rust-lang/rust/pull/95503, I realized that this will interfere with existing command lines: Currently people run `x build library/std` expecting it to be added to the sysroot, but after that change, it will *only* build `libstd` without making it available for the toolchain. It's debatable whether that's a breaking change that will be accepted; if so, this PR is absolutely necessary to make sure there's a command for "build the standard library and add it to the sysroot". Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. For consistency, also add support for `compiler` and all other command variants. Note that `doc compiler` was already supported, so in a sense this is just fixing an existing inconsistency. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged.
2022-03-30Rollup merge of #95461 - nyurik:spelling, r=lcnrDylan DPC-1/+1
Spellchecking some comments This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-28Propagate `parallel_compiler` feature through rustc crates. Turned off ↵klensy-0/+2
feature gives change of builded crates: 238 -> 224.
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-05Merge build_helper into utilbjorn3-2/+1
2022-03-05Remove build_helperbjorn3-1/+1
The majority of the code is only used by either rustbuild or rustc_llvm's build script. Rust_build is compiled once for rustbuild and once for every stage. This means that the majority of the code in this crate is needlessly compiled multiple times. By moving only the code actually used by the respective crates to rustbuild and rustc_llvm's build script, this needless duplicate compilation is avoided.
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-4/+11
First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are already read by `cc` and populated into `Build` earlier on in the process. We shouldn't be overriding that based on `CFLAGS`, since `cc` also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which we want to take into account. Second, this adds the same capability to specify target-specific versions of `LDFLAGS` as we have through `cc` for the `C*` flags: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables Note that this also necessitated an update to compiletest to treat CXXFLAGS separately from CFLAGS.
2022-02-27Rollup merge of #94415 - bjorn3:cfg_default_backend, r=Mark-SimulacrumMatthias Krüger-0/+4
Use the first codegen backend in the config.toml as default It is currently hard coded to llvm if enabled and cranelift otherwise. This made some sense when cranelift was the only alternative codegen backend. Since the introduction of the gcc backend this doesn't make much sense anymore. Before this PR bootstrapping rustc using a backend other than llvm or cranelift required changing the source of rustc_interface. With this PR it becomes a matter of putting the right backend as first enabled backend in config.toml. cc ```@antoyo```
2022-02-27Use the first codegen backend in the config.toml as defaultbjorn3-0/+4
It is currently hard coded to llvm if enabled and cranelift otherwise. This made some sense when cranelift was the only alternative codegen backend. Since the introduction of the gcc backend this doesn't make much sense anymore. Before this PR bootstrapping rustc using a backend other than llvm or cranelift required changing the source of rustc_interface. With this PR it becomes a matter of putting the right backend as first enabled backend in config.toml.
2022-02-23Always check cg_llvm with ./x.py checkbjorn3-1/+1
Previously it would be skipped if codegen-backends doesn't contain llvm.
2022-02-20Use Metadata::modified instead of FileTime::from_last_modification_time in ↵bjorn3-3/+3
run_cargo Metadata::modified works in all platforms supported by the filetime crate. This changes brings rustbuild a tiny bit closer towards dropping the filetime dependency.
2022-01-15Exclude llvm-libunwind from the self-contained set on s390x-musl targets.Ariadne Conill-2/+4
llvm-libunwind does not support s390x targets at present, so we cannot build it for s390x targets. Accordingly, remove it from the self-contained set.
2022-01-06Revert "bootstrap: copy `llvm-dwp` to sysroot"David Wood-7/+0
This reverts commit 241160de72b5b55187ca54243e2a6e82e336d07c.
2021-12-31rustbuild: Add support for a per-target default-linker option.Maxim Cournoyer-2/+9
2021-12-09Don't copy llvm tools to sysroot when using download-ci-llvmAaron Hill-1/+6
Fixes #91710
2021-12-08Install llvm tools to sysroot when assembling local toolchainAaron Hill-0/+11
Some projects (e.g. the `bootimage` crate) may require the user to install the `llvm-tools-preview` rustup component. However, this cannot be easily done with a locally built toolchain. To allow a local toolchain to be used a drop-in replacement for a normal rustup toolchain in more cases, this PR copies the built LLVM tools to the sysoot. From the perspective a tool looking at the sysroot, this is equivalent to installing `llvm-tools-preview`.
2021-11-03Provide standalone libc.a in self-contained for musl and wasi12101111-3/+3
2021-10-13Rollup merge of #89759 - jyn514:x-build-assemble, r=Mark-SimulacrumMatthias Krüger-2/+9
Assemble the compiler when running `x.py build` Previously, there was no way to actually get binaries in `build/$TARGET/stage1/bin` without building the standard library. This makes it possible to build just the compiler. This can be useful when the standard library isn't actually necessary for trying out your tests (e.g. a bug that can be reproduced with only a `no_core` crate). Closes https://github.com/rust-lang/rust/issues/73519.