about summary refs log tree commit diff
path: root/src/bootstrap/bin
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2023-10-07 23:33:27 +0300
committeronur-ozkan <work@onurozkan.dev>2023-10-17 10:06:48 +0300
commitacef1c2c576c778e7a3c8e249298eb10450ae7e8 (patch)
tree9f12e853c417a138394ee4ad2eb6481439974aba /src/bootstrap/bin
parent631a116cd3b326096340691e60bf74e9868289a6 (diff)
downloadrust-acef1c2c576c778e7a3c8e249298eb10450ae7e8.tar.gz
rust-acef1c2c576c778e7a3c8e249298eb10450ae7e8.zip
reorganize bootstrap bins and helper module utilizations
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src/bootstrap/bin')
-rw-r--r--src/bootstrap/bin/_helper.rs25
-rw-r--r--src/bootstrap/bin/main.rs139
-rw-r--r--src/bootstrap/bin/rustc.rs392
-rw-r--r--src/bootstrap/bin/rustdoc.rs86
-rw-r--r--src/bootstrap/bin/sccache-plus-cl.rs38
5 files changed, 0 insertions, 680 deletions
diff --git a/src/bootstrap/bin/_helper.rs b/src/bootstrap/bin/_helper.rs
deleted file mode 100644
index 46c574c5bf4..00000000000
--- a/src/bootstrap/bin/_helper.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-/// Parses the value of the "RUSTC_VERBOSE" environment variable and returns it as a `usize`.
-/// If it was not defined, returns 0 by default.
-///
-/// Panics if "RUSTC_VERBOSE" is defined with the value that is not an unsigned integer.
-fn parse_rustc_verbose() -> usize {
-    use std::str::FromStr;
-
-    match std::env::var("RUSTC_VERBOSE") {
-        Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"),
-        Err(_) => 0,
-    }
-}
-
-/// Parses the value of the "RUSTC_STAGE" environment variable and returns it as a `String`.
-///
-/// If "RUSTC_STAGE" was not set, the program will be terminated with 101.
-#[allow(unused)]
-fn parse_rustc_stage() -> String {
-    std::env::var("RUSTC_STAGE").unwrap_or_else(|_| {
-        // Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead.
-        eprintln!("rustc shim: fatal: RUSTC_STAGE was not set");
-        eprintln!("rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap");
-        exit(101);
-    })
-}
diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs
deleted file mode 100644
index d87fb6a9cef..00000000000
--- a/src/bootstrap/bin/main.rs
+++ /dev/null
@@ -1,139 +0,0 @@
-//! rustbuild, the Rust build system
-//!
-//! This is the entry point for the build system used to compile the `rustc`
-//! compiler. Lots of documentation can be found in the `README.md` file in the
-//! parent directory, and otherwise documentation can be found throughout the `build`
-//! directory in each respective module.
-
-#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-use std::io::Write;
-#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-use std::process;
-use std::{env, fs};
-
-#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-use bootstrap::t;
-use bootstrap::{find_recent_config_change_ids, Build, Config, Subcommand, CONFIG_CHANGE_HISTORY};
-
-fn main() {
-    let args = env::args().skip(1).collect::<Vec<_>>();
-    let config = Config::parse(&args);
-
-    #[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-    let mut build_lock;
-    #[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-    let _build_lock_guard;
-    #[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-    // Display PID of process holding the lock
-    // PID will be stored in a lock file
-    {
-        let path = config.out.join("lock");
-        let pid = match fs::read_to_string(&path) {
-            Ok(contents) => contents,
-            Err(_) => String::new(),
-        };
-
-        build_lock =
-            fd_lock::RwLock::new(t!(fs::OpenOptions::new().write(true).create(true).open(&path)));
-        _build_lock_guard = match build_lock.try_write() {
-            Ok(mut lock) => {
-                t!(lock.write(&process::id().to_string().as_ref()));
-                lock
-            }
-            err => {
-                drop(err);
-                println!("WARNING: build directory locked by process {pid}, waiting for lock");
-                let mut lock = t!(build_lock.write());
-                t!(lock.write(&process::id().to_string().as_ref()));
-                lock
-            }
-        };
-    }
-
-    #[cfg(any(not(any(unix, windows)), target_os = "solaris"))]
-    println!("WARNING: file locking not supported for target, not locking build directory");
-
-    // check_version warnings are not printed during setup
-    let changelog_suggestion =
-        if matches!(config.cmd, Subcommand::Setup { .. }) { None } else { check_version(&config) };
-
-    // NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
-    // changelog warning, not the `x.py setup` message.
-    let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. });
-    if suggest_setup {
-        println!("WARNING: you have not made a `config.toml`");
-        println!(
-            "help: consider running `./x.py setup` or copying `config.example.toml` by running \
-            `cp config.example.toml config.toml`"
-        );
-    } else if let Some(suggestion) = &changelog_suggestion {
-        println!("{suggestion}");
-    }
-
-    let pre_commit = config.src.join(".git").join("hooks").join("pre-commit");
-    Build::new(config).build();
-
-    if suggest_setup {
-        println!("WARNING: you have not made a `config.toml`");
-        println!(
-            "help: consider running `./x.py setup` or copying `config.example.toml` by running \
-            `cp config.example.toml config.toml`"
-        );
-    } else if let Some(suggestion) = &changelog_suggestion {
-        println!("{suggestion}");
-    }
-
-    // Give a warning if the pre-commit script is in pre-commit and not pre-push.
-    // HACK: Since the commit script uses hard links, we can't actually tell if it was installed by x.py setup or not.
-    // We could see if it's identical to src/etc/pre-push.sh, but pre-push may have been modified in the meantime.
-    // Instead, look for this comment, which is almost certainly not in any custom hook.
-    if fs::read_to_string(pre_commit).map_or(false, |contents| {
-        contents.contains("https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570")
-    }) {
-        println!(
-            "WARNING: You have the pre-push script installed to .git/hooks/pre-commit. \
-                  Consider moving it to .git/hooks/pre-push instead, which runs less often."
-        );
-    }
-
-    if suggest_setup || changelog_suggestion.is_some() {
-        println!("note: this message was printed twice to make it more likely to be seen");
-    }
-}
-
-fn check_version(config: &Config) -> Option<String> {
-    let mut msg = String::new();
-
-    if config.changelog_seen.is_some() {
-        msg.push_str("WARNING: The use of `changelog-seen` is deprecated. Please refer to `change-id` option in `config.example.toml` instead.\n");
-    }
-
-    let latest_config_id = CONFIG_CHANGE_HISTORY.last().unwrap();
-    let suggestion = if let Some(id) = config.change_id {
-        if &id != latest_config_id {
-            msg.push_str("WARNING: there have been changes to x.py since you last updated.\n");
-            let change_links: Vec<String> = find_recent_config_change_ids(id)
-                .iter()
-                .map(|id| format!("https://github.com/rust-lang/rust/pull/{id}"))
-                .collect();
-            if !change_links.is_empty() {
-                msg.push_str("To see more detail about these changes, visit the following PRs:\n");
-                for link in change_links {
-                    msg.push_str(&format!("  - {link}\n"));
-                }
-            }
-            msg.push_str("WARNING: there have been changes to x.py since you last updated.\n");
-            format!("update `config.toml` to use `change-id = {latest_config_id}` instead")
-        } else {
-            return None;
-        }
-    } else {
-        msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");
-        format!("add `change-id = {latest_config_id}` at the top of `config.toml`")
-    };
-
-    msg.push_str("note: to silence this warning, ");
-    msg.push_str(&suggestion);
-
-    Some(msg)
-}
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
deleted file mode 100644
index 6cc5162120a..00000000000
--- a/src/bootstrap/bin/rustc.rs
+++ /dev/null
@@ -1,392 +0,0 @@
-//! Shim which is passed to Cargo as "rustc" when running the bootstrap.
-//!
-//! This shim will take care of some various tasks that our build process
-//! requires that Cargo can't quite do through normal configuration:
-//!
-//! 1. When compiling build scripts and build dependencies, we need a guaranteed
-//!    full standard library available. The only compiler which actually has
-//!    this is the snapshot, so we detect this situation and always compile with
-//!    the snapshot compiler.
-//! 2. We pass a bunch of `--cfg` and other flags based on what we're compiling
-//!    (and this slightly differs based on a whether we're using a snapshot or
-//!    not), so we do that all here.
-//!
-//! This may one day be replaced by RUSTFLAGS, but the dynamic nature of
-//! switching compilers for the bootstrap and for build scripts will probably
-//! never get replaced.
-
-include!("../dylib_util.rs");
-include!("./_helper.rs");
-
-use std::env;
-use std::path::PathBuf;
-use std::process::{exit, Child, Command};
-use std::time::Instant;
-
-fn main() {
-    let args = env::args_os().skip(1).collect::<Vec<_>>();
-    let arg = |name| args.windows(2).find(|args| args[0] == name).and_then(|args| args[1].to_str());
-
-    let verbose = parse_rustc_verbose();
-
-    // Detect whether or not we're a build script depending on whether --target
-    // is passed (a bit janky...)
-    let target = arg("--target");
-    let version = args.iter().find(|w| &**w == "-vV");
-
-    // Use a different compiler for build scripts, since there may not yet be a
-    // libstd for the real compiler to use. However, if Cargo is attempting to
-    // determine the version of the compiler, the real compiler needs to be
-    // used. Currently, these two states are differentiated based on whether
-    // --target and -vV is/isn't passed.
-    let (rustc, libdir) = if target.is_none() && version.is_none() {
-        ("RUSTC_SNAPSHOT", "RUSTC_SNAPSHOT_LIBDIR")
-    } else {
-        ("RUSTC_REAL", "RUSTC_LIBDIR")
-    };
-
-    let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
-    let on_fail = env::var_os("RUSTC_ON_FAIL").map(Command::new);
-
-    let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
-    let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
-    let mut dylib_path = dylib_path();
-    dylib_path.insert(0, PathBuf::from(&libdir));
-
-    let mut cmd = Command::new(rustc);
-    cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
-
-    // Get the name of the crate we're compiling, if any.
-    let crate_name = arg("--crate-name");
-
-    if let Some(crate_name) = crate_name {
-        if let Some(target) = env::var_os("RUSTC_TIME") {
-            if target == "all"
-                || target.into_string().unwrap().split(',').any(|c| c.trim() == crate_name)
-            {
-                cmd.arg("-Ztime-passes");
-            }
-        }
-    }
-
-    // Print backtrace in case of ICE
-    if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
-        cmd.env("RUST_BACKTRACE", "1");
-    }
-
-    if let Ok(lint_flags) = env::var("RUSTC_LINT_FLAGS") {
-        cmd.args(lint_flags.split_whitespace());
-    }
-
-    if target.is_some() {
-        // The stage0 compiler has a special sysroot distinct from what we
-        // actually downloaded, so we just always pass the `--sysroot` option,
-        // unless one is already set.
-        if !args.iter().any(|arg| arg == "--sysroot") {
-            cmd.arg("--sysroot").arg(&sysroot);
-        }
-
-        // If we're compiling specifically the `panic_abort` crate then we pass
-        // the `-C panic=abort` option. Note that we do not do this for any
-        // other crate intentionally as this is the only crate for now that we
-        // ship with panic=abort.
-        //
-        // This... is a bit of a hack how we detect this. Ideally this
-        // information should be encoded in the crate I guess? Would likely
-        // require an RFC amendment to RFC 1513, however.
-        if crate_name == Some("panic_abort") {
-            cmd.arg("-C").arg("panic=abort");
-        }
-
-        // `-Ztls-model=initial-exec` must not be applied to proc-macros, see
-        // issue https://github.com/rust-lang/rust/issues/100530
-        if env::var("RUSTC_TLS_MODEL_INITIAL_EXEC").is_ok()
-            && arg("--crate-type") != Some("proc-macro")
-            && !matches!(crate_name, Some("proc_macro2" | "quote" | "syn" | "synstructure"))
-        {
-            cmd.arg("-Ztls-model=initial-exec");
-        }
-    } else {
-        // Find any host flags that were passed by bootstrap.
-        // The flags are stored in a RUSTC_HOST_FLAGS variable, separated by spaces.
-        if let Ok(flags) = std::env::var("RUSTC_HOST_FLAGS") {
-            for flag in flags.split(' ') {
-                cmd.arg(flag);
-            }
-        }
-    }
-
-    if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
-        cmd.arg("--remap-path-prefix").arg(&map);
-    }
-
-    // Force all crates compiled by this compiler to (a) be unstable and (b)
-    // allow the `rustc_private` feature to link to other unstable crates
-    // also in the sysroot. We also do this for host crates, since those
-    // may be proc macros, in which case we might ship them.
-    if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
-        cmd.arg("-Z").arg("force-unstable-if-unmarked");
-    }
-
-    // allow-features is handled from within this rustc wrapper because of
-    // issues with build scripts. Some packages use build scripts to
-    // dynamically detect if certain nightly features are available.
-    // There are different ways this causes problems:
-    //
-    // * rustix runs `rustc` on a small test program to see if the feature is
-    //   available (and sets a `cfg` if it is). It does not honor
-    //   CARGO_ENCODED_RUSTFLAGS.
-    // * proc-macro2 detects if `rustc -vV` says "nighty" or "dev" and enables
-    //   nightly features. It will scan CARGO_ENCODED_RUSTFLAGS for
-    //   -Zallow-features. Unfortunately CARGO_ENCODED_RUSTFLAGS is not set
-    //   for build-dependencies when --target is used.
-    //
-    // The issues above means we can't just use RUSTFLAGS, and we can't use
-    // `cargo -Zallow-features=…`. Passing it through here ensures that it
-    // always gets set. Unfortunately that also means we need to enable more
-    // features than we really want (like those for proc-macro2), but there
-    // isn't much of a way around it.
-    //
-    // I think it is unfortunate that build scripts are doing this at all,
-    // since changes to nightly features can cause crates to break even if the
-    // user didn't want or care about the use of the nightly features. I think
-    // nightly features should be opt-in only. Unfortunately the dynamic
-    // checks are now too wide spread that we just need to deal with it.
-    //
-    // If you want to try to remove this, I suggest working with the crate
-    // authors to remove the dynamic checking. Another option is to pursue
-    // https://github.com/rust-lang/cargo/issues/11244 and
-    // https://github.com/rust-lang/cargo/issues/4423, which will likely be
-    // very difficult, but could help expose -Zallow-features into build
-    // scripts so they could try to honor them.
-    if let Ok(allow_features) = env::var("RUSTC_ALLOW_FEATURES") {
-        cmd.arg(format!("-Zallow-features={allow_features}"));
-    }
-
-    if let Ok(flags) = env::var("MAGIC_EXTRA_RUSTFLAGS") {
-        for flag in flags.split(' ') {
-            cmd.arg(flag);
-        }
-    }
-
-    let is_test = args.iter().any(|a| a == "--test");
-    if verbose > 2 {
-        let rust_env_vars =
-            env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
-        let prefix = if is_test { "[RUSTC-SHIM] rustc --test" } else { "[RUSTC-SHIM] rustc" };
-        let prefix = match crate_name {
-            Some(crate_name) => format!("{prefix} {crate_name}"),
-            None => prefix.to_string(),
-        };
-        for (i, (k, v)) in rust_env_vars.enumerate() {
-            eprintln!("{prefix} env[{i}]: {k:?}={v:?}");
-        }
-        eprintln!("{} working directory: {}", prefix, env::current_dir().unwrap().display());
-        eprintln!(
-            "{} command: {:?}={:?} {:?}",
-            prefix,
-            dylib_path_var(),
-            env::join_paths(&dylib_path).unwrap(),
-            cmd,
-        );
-        eprintln!("{prefix} sysroot: {sysroot:?}");
-        eprintln!("{prefix} libdir: {libdir:?}");
-    }
-
-    if env::var_os("RUSTC_BOLT_LINK_FLAGS").is_some() {
-        if let Some("rustc_driver") = crate_name {
-            cmd.arg("-Clink-args=-Wl,-q");
-        }
-    }
-
-    let start = Instant::now();
-    let (child, status) = {
-        let errmsg = format!("\nFailed to run:\n{cmd:?}\n-------------");
-        let mut child = cmd.spawn().expect(&errmsg);
-        let status = child.wait().expect(&errmsg);
-        (child, status)
-    };
-
-    if env::var_os("RUSTC_PRINT_STEP_TIMINGS").is_some()
-        || env::var_os("RUSTC_PRINT_STEP_RUSAGE").is_some()
-    {
-        if let Some(crate_name) = crate_name {
-            let dur = start.elapsed();
-            // If the user requested resource usage data, then
-            // include that in addition to the timing output.
-            let rusage_data =
-                env::var_os("RUSTC_PRINT_STEP_RUSAGE").and_then(|_| format_rusage_data(child));
-            eprintln!(
-                "[RUSTC-TIMING] {} test:{} {}.{:03}{}{}",
-                crate_name,
-                is_test,
-                dur.as_secs(),
-                dur.subsec_millis(),
-                if rusage_data.is_some() { " " } else { "" },
-                rusage_data.unwrap_or(String::new()),
-            );
-        }
-    }
-
-    if status.success() {
-        std::process::exit(0);
-        // note: everything below here is unreachable. do not put code that
-        // should run on success, after this block.
-    }
-    if verbose > 0 {
-        println!("\nDid not run successfully: {status}\n{cmd:?}\n-------------");
-    }
-
-    if let Some(mut on_fail) = on_fail {
-        on_fail.status().expect("Could not run the on_fail command");
-    }
-
-    // Preserve the exit code. In case of signal, exit with 0xfe since it's
-    // awkward to preserve this status in a cross-platform way.
-    match status.code() {
-        Some(i) => std::process::exit(i),
-        None => {
-            eprintln!("rustc exited with {status}");
-            std::process::exit(0xfe);
-        }
-    }
-}
-
-#[cfg(all(not(unix), not(windows)))]
-// In the future we can add this for more platforms
-fn format_rusage_data(_child: Child) -> Option<String> {
-    None
-}
-
-#[cfg(windows)]
-fn format_rusage_data(child: Child) -> Option<String> {
-    use std::os::windows::io::AsRawHandle;
-
-    use windows::{
-        Win32::Foundation::HANDLE,
-        Win32::System::ProcessStatus::{
-            K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS, PROCESS_MEMORY_COUNTERS_EX,
-        },
-        Win32::System::Threading::GetProcessTimes,
-        Win32::System::Time::FileTimeToSystemTime,
-    };
-
-    let handle = HANDLE(child.as_raw_handle() as isize);
-
-    let mut user_filetime = Default::default();
-    let mut user_time = Default::default();
-    let mut kernel_filetime = Default::default();
-    let mut kernel_time = Default::default();
-    let mut memory_counters = PROCESS_MEMORY_COUNTERS::default();
-
-    unsafe {
-        GetProcessTimes(
-            handle,
-            &mut Default::default(),
-            &mut Default::default(),
-            &mut kernel_filetime,
-            &mut user_filetime,
-        )
-    }
-    .ok()
-    .ok()?;
-    unsafe { FileTimeToSystemTime(&user_filetime, &mut user_time) }.ok().ok()?;
-    unsafe { FileTimeToSystemTime(&kernel_filetime, &mut kernel_time) }.ok().ok()?;
-
-    // Unlike on Linux with RUSAGE_CHILDREN, this will only return memory information for the process
-    // with the given handle and none of that process's children.
-    unsafe {
-        K32GetProcessMemoryInfo(
-            handle,
-            &mut memory_counters,
-            std::mem::size_of::<PROCESS_MEMORY_COUNTERS_EX>() as u32,
-        )
-    }
-    .ok()
-    .ok()?;
-
-    // Guide on interpreting these numbers:
-    // https://docs.microsoft.com/en-us/windows/win32/psapi/process-memory-usage-information
-    let peak_working_set = memory_counters.PeakWorkingSetSize / 1024;
-    let peak_page_file = memory_counters.PeakPagefileUsage / 1024;
-    let peak_paged_pool = memory_counters.QuotaPeakPagedPoolUsage / 1024;
-    let peak_nonpaged_pool = memory_counters.QuotaPeakNonPagedPoolUsage / 1024;
-    Some(format!(
-        "user: {USER_SEC}.{USER_USEC:03} \
-         sys: {SYS_SEC}.{SYS_USEC:03} \
-         peak working set (kb): {PEAK_WORKING_SET} \
-         peak page file usage (kb): {PEAK_PAGE_FILE} \
-         peak paged pool usage (kb): {PEAK_PAGED_POOL} \
-         peak non-paged pool usage (kb): {PEAK_NONPAGED_POOL} \
-         page faults: {PAGE_FAULTS}",
-        USER_SEC = user_time.wSecond + (user_time.wMinute * 60),
-        USER_USEC = user_time.wMilliseconds,
-        SYS_SEC = kernel_time.wSecond + (kernel_time.wMinute * 60),
-        SYS_USEC = kernel_time.wMilliseconds,
-        PEAK_WORKING_SET = peak_working_set,
-        PEAK_PAGE_FILE = peak_page_file,
-        PEAK_PAGED_POOL = peak_paged_pool,
-        PEAK_NONPAGED_POOL = peak_nonpaged_pool,
-        PAGE_FAULTS = memory_counters.PageFaultCount,
-    ))
-}
-
-#[cfg(unix)]
-/// Tries to build a string with human readable data for several of the rusage
-/// fields. Note that we are focusing mainly on data that we believe to be
-/// supplied on Linux (the `rusage` struct has other fields in it but they are
-/// currently unsupported by Linux).
-fn format_rusage_data(_child: Child) -> Option<String> {
-    let rusage: libc::rusage = unsafe {
-        let mut recv = std::mem::zeroed();
-        // -1 is RUSAGE_CHILDREN, which means to get the rusage for all children
-        // (and grandchildren, etc) processes that have respectively terminated
-        // and been waited for.
-        let retval = libc::getrusage(-1, &mut recv);
-        if retval != 0 {
-            return None;
-        }
-        recv
-    };
-    // Mac OS X reports the maxrss in bytes, not kb.
-    let divisor = if env::consts::OS == "macos" { 1024 } else { 1 };
-    let maxrss = (rusage.ru_maxrss + (divisor - 1)) / divisor;
-
-    let mut init_str = format!(
-        "user: {USER_SEC}.{USER_USEC:03} \
-         sys: {SYS_SEC}.{SYS_USEC:03} \
-         max rss (kb): {MAXRSS}",
-        USER_SEC = rusage.ru_utime.tv_sec,
-        USER_USEC = rusage.ru_utime.tv_usec,
-        SYS_SEC = rusage.ru_stime.tv_sec,
-        SYS_USEC = rusage.ru_stime.tv_usec,
-        MAXRSS = maxrss
-    );
-
-    // The remaining rusage stats vary in platform support. So we treat
-    // uniformly zero values in each category as "not worth printing", since it
-    // either means no events of that type occurred, or that the platform
-    // does not support it.
-
-    let minflt = rusage.ru_minflt;
-    let majflt = rusage.ru_majflt;
-    if minflt != 0 || majflt != 0 {
-        init_str.push_str(&format!(" page reclaims: {minflt} page faults: {majflt}"));
-    }
-
-    let inblock = rusage.ru_inblock;
-    let oublock = rusage.ru_oublock;
-    if inblock != 0 || oublock != 0 {
-        init_str.push_str(&format!(" fs block inputs: {inblock} fs block outputs: {oublock}"));
-    }
-
-    let nvcsw = rusage.ru_nvcsw;
-    let nivcsw = rusage.ru_nivcsw;
-    if nvcsw != 0 || nivcsw != 0 {
-        init_str.push_str(&format!(
-            " voluntary ctxt switches: {nvcsw} involuntary ctxt switches: {nivcsw}"
-        ));
-    }
-
-    return Some(init_str);
-}
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
deleted file mode 100644
index 6561c1c1933..00000000000
--- a/src/bootstrap/bin/rustdoc.rs
+++ /dev/null
@@ -1,86 +0,0 @@
-//! Shim which is passed to Cargo as "rustdoc" when running the bootstrap.
-//!
-//! See comments in `src/bootstrap/rustc.rs` for more information.
-
-use std::env;
-use std::ffi::OsString;
-use std::path::PathBuf;
-use std::process::{exit, Command};
-
-include!("../dylib_util.rs");
-
-include!("./_helper.rs");
-
-fn main() {
-    let args = env::args_os().skip(1).collect::<Vec<_>>();
-
-    let stage = parse_rustc_stage();
-    let verbose = parse_rustc_verbose();
-
-    let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
-    let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
-    let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
-
-    // Detect whether or not we're a build script depending on whether --target
-    // is passed (a bit janky...)
-    let target = args.windows(2).find(|w| &*w[0] == "--target").and_then(|w| w[1].to_str());
-
-    let mut dylib_path = dylib_path();
-    dylib_path.insert(0, PathBuf::from(libdir.clone()));
-
-    let mut cmd = Command::new(rustdoc);
-
-    if target.is_some() {
-        // The stage0 compiler has a special sysroot distinct from what we
-        // actually downloaded, so we just always pass the `--sysroot` option,
-        // unless one is already set.
-        if !args.iter().any(|arg| arg == "--sysroot") {
-            cmd.arg("--sysroot").arg(&sysroot);
-        }
-    }
-
-    cmd.args(&args);
-    cmd.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
-
-    // Force all crates compiled by this compiler to (a) be unstable and (b)
-    // allow the `rustc_private` feature to link to other unstable crates
-    // also in the sysroot.
-    if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
-        cmd.arg("-Z").arg("force-unstable-if-unmarked");
-    }
-    if let Some(linker) = env::var_os("RUSTDOC_LINKER") {
-        let mut arg = OsString::from("-Clinker=");
-        arg.push(&linker);
-        cmd.arg(arg);
-    }
-    if let Ok(no_threads) = env::var("RUSTDOC_LLD_NO_THREADS") {
-        cmd.arg("-Clink-arg=-fuse-ld=lld");
-        cmd.arg(format!("-Clink-arg=-Wl,{no_threads}"));
-    }
-    // Cargo doesn't pass RUSTDOCFLAGS to proc_macros:
-    // https://github.com/rust-lang/cargo/issues/4423
-    // Thus, if we are on stage 0, we explicitly set `--cfg=bootstrap`.
-    // We also declare that the flag is expected, which we need to do to not
-    // get warnings about it being unexpected.
-    if stage == "0" {
-        cmd.arg("--cfg=bootstrap");
-    }
-    cmd.arg("-Zunstable-options");
-    cmd.arg("--check-cfg=values(bootstrap)");
-
-    if verbose > 1 {
-        eprintln!(
-            "rustdoc command: {:?}={:?} {:?}",
-            dylib_path_var(),
-            env::join_paths(&dylib_path).unwrap(),
-            cmd,
-        );
-        eprintln!("sysroot: {sysroot:?}");
-        eprintln!("libdir: {libdir:?}");
-    }
-
-    std::process::exit(match cmd.status() {
-        Ok(s) => s.code().unwrap_or(1),
-        Err(e) => panic!("\n\nfailed to run {cmd:?}: {e}\n\n"),
-    })
-}
diff --git a/src/bootstrap/bin/sccache-plus-cl.rs b/src/bootstrap/bin/sccache-plus-cl.rs
deleted file mode 100644
index 554c2dd4d81..00000000000
--- a/src/bootstrap/bin/sccache-plus-cl.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-use std::env;
-use std::process::{self, Command};
-
-fn main() {
-    let target = env::var("SCCACHE_TARGET").unwrap();
-    // Locate the actual compiler that we're invoking
-    env::set_var("CC", env::var_os("SCCACHE_CC").unwrap());
-    env::set_var("CXX", env::var_os("SCCACHE_CXX").unwrap());
-    let mut cfg = cc::Build::new();
-    cfg.cargo_metadata(false)
-        .out_dir("/")
-        .target(&target)
-        .host(&target)
-        .opt_level(0)
-        .warnings(false)
-        .debug(false);
-    let compiler = cfg.get_compiler();
-
-    // Invoke sccache with said compiler
-    let sccache_path = env::var_os("SCCACHE_PATH").unwrap();
-    let mut cmd = Command::new(&sccache_path);
-    cmd.arg(compiler.path());
-    for &(ref k, ref v) in compiler.env() {
-        cmd.env(k, v);
-    }
-    for arg in env::args().skip(1) {
-        cmd.arg(arg);
-    }
-
-    if let Ok(s) = env::var("SCCACHE_EXTRA_ARGS") {
-        for s in s.split_whitespace() {
-            cmd.arg(s);
-        }
-    }
-
-    let status = cmd.status().expect("failed to spawn");
-    process::exit(status.code().unwrap_or(2))
-}