about summary refs log tree commit diff
path: root/src/bootstrap/compile.rs
AgeCommit message (Collapse)AuthorLines
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-1/+1
2023-01-04Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`"Joshua Nelson-2/+10
This reverts commit 9dfe50440e6d48bd2fd40a4b7b3992998e55eace. Fixes `x clippy`.
2022-12-31Only include metadata for non-dynamic libraries in rustc-devbjorn3-6/+43
The actual object code should be linked from librustc_driver.so, which is still included in rustc-dev. This saves on download time and disk usage.
2022-12-30bootstrap: Get rid of `tail_args` in `stream_cargo`Joshua Nelson-24/+4
2022-12-30Use more consistent progress messages in bootstrapJoshua Nelson-8/+18
Before: ``` Testing ["rustc_interface"] stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ``` After: ``` Testing {rustc_interface} stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ``` Note there is a slight consistency between `build` and `test`: The former doesn't print "compiler artifacts". It would be annoying to fix and doesn't hurt anything, so I left it be. ``` ; x t rustc_interface --stage 0 --dry-run Testing {rustc_interface} stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ; x b rustc_interface --stage 0 --dry-run Building {rustc_interface} stage0 compiler artifacts (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ```
2022-12-29Support `x clean --stage 1 rustc_query_impl`Joshua Nelson-4/+11
Previously, clean only supported `--stage 0` for specific crates. The new `crate_description` function generates a string that looks like ``` : {rustc_query_impl} ```
2022-12-28Skip LTO in stage0 (again)Mark Rousskov-16/+20
2022-12-28delete more `cfg(bootstrap)`Lukas Markeffsky-19/+16
2022-12-26Allow cleaning individual cratesJoshua Nelson-13/+2
As a bonus, this stops special casing `clean` in `Builder`.
2022-12-23Rollup merge of #106051 - jyn514:cranelift-std, r=bjorn3Matthias Krüger-3/+10
Allow building std with cranelift - Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift r? `@bjorn3` cc `@Mark-Simulacrum`
2022-12-22Allow building std with craneliftJoshua Nelson-3/+10
- Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift
2022-12-22Use LLVM_CMAKE_DIR for lld buildNikita Popov-3/+4
LLVM_CONFIG_PATH is no longer supported as of LLVM 16, switch to using the cmake module instead. We separately return the llvm-config and cmake directory paths, because llvm-config always refers to the host binary, while the cmake directory is for the target triple.
2022-11-19Rollup merge of #104076 - ozkanonur:fix-ci-rustc-sysroot, r=jyn514Matthias Krüger-9/+20
fix sysroot issue which appears for ci downloaded rustc Currently when compiler is downloaded rather than compiled, sysroot is being `ci-rustc-sysroot` because of https://github.com/rust-lang/rust/blob/7eef946fc0e0eff40e588eab77b09b287accbec3/src/bootstrap/compile.rs#L1125-L1131 this. And rustdoc is overriding the downloaded one at the end of the process. With the condition I add, we simply check if the current compiler stage is target build stage, if so use the proper sysroot instead of `ci-rustc-sysroot`. Resolves #103206
2022-11-13Make all download functions need only Config, not BuilderJoshua Nelson-2/+2
This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.
2022-11-13Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomccbors-1/+0
Change the way libunwind is linked for *-windows-gnullvm targets I have no idea why previous way works for `x86_64-fortanix-unknown-sgx` (assuming it actually works...) but not for `gnullvm`. It fails when linking libtest during Rust build (unless somebody adds `RUSTFLAGS='-Clinkarg=-lunwind'`). Also fixes exception handling on AArch64.
2022-11-13check if current stage is target build stage r=ozkanonurozkanonur-9/+20
Signed-off-by: ozkanonur <work@onurozkan.dev>
2022-11-12Distinguish `--dry-run` from the automatic dry run checkJoshua Nelson-6/+6
2022-11-01Change the way libunwind is linked for `*-windows-gnullvm` targetsMateusz Mikuła-1/+0
2022-10-29Revert "Make the `c` feature for `compiler-builtins` opt-in instead of inferred"Mark Rousskov-10/+5
This reverts commit 3acb505ee560770c62bad5362f6caf7567d467b9 (PR #101833). The changes in this commit caused several bugs or at least incompatibilies. For now we're reverting this commit and will re-land it alongside fixes for those bugs.
2022-10-23Rollup merge of #103347 - RalfJung:rustc-src, r=Mark-SimulacrumMichael Howell-0/+14
bootstrap: also create rustc-src component in sysroot Fixes https://github.com/rust-lang/rust-analyzer/issues/12926
2022-10-23Introduce dedicated `-Zdylib-lto` flag for enabling LTO on `dylib`sJakub Beránek-0/+22
2022-10-23Add `rust.lto` config optionJakub Beránek-1/+1
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