diff options
| author | bors <bors@rust-lang.org> | 2025-01-25 22:05:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-25 22:05:02 +0000 |
| commit | 6fb03584cf6d915cc5527f45037ca009f4273c4c (patch) | |
| tree | f6aaa2947f4223e2c2663949df2e3f8ba2670bf6 /compiler/rustc_codegen_ssa/src/back/command.rs | |
| parent | f7cc13af822fe68c64fec0b05aa9dd1412451f7c (diff) | |
| parent | c1b4ab0e7369836aaabd3e3b5ff2d8c11471e81f (diff) | |
| download | rust-6fb03584cf6d915cc5527f45037ca009f4273c4c.tar.gz rust-6fb03584cf6d915cc5527f45037ca009f4273c4c.zip | |
Auto merge of #135707 - jyn514:linker-messages-2, r=bjorn3
Shorten linker output even more when `--verbose` is not present - Don't show environment variables. Seeing PATH is almost never useful, and it can be extremely long. - For .rlibs in the sysroot, replace crate hashes with a `"-*"` string. This will expand to the full crate name when pasted into the shell. - Move `.rlib` to outside the glob. - Abbreviate the sysroot path to `<sysroot>` wherever it appears in the arguments. This also adds an example of the linker output as a run-make test. Currently it only runs on x86_64-unknown-linux-gnu, because each platform has its own linker arguments. So that it's stable across machines, pass BUILD_ROOT as an argument through compiletest through to run-make tests. r? `@bjorn3` try-job: aarch64-apple
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back/command.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/command.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/command.rs b/compiler/rustc_codegen_ssa/src/back/command.rs index b3c5b86ccf4..63023fdba20 100644 --- a/compiler/rustc_codegen_ssa/src/back/command.rs +++ b/compiler/rustc_codegen_ssa/src/back/command.rs @@ -13,6 +13,7 @@ pub(crate) struct Command { args: Vec<OsString>, env: Vec<(OsString, OsString)>, env_remove: Vec<OsString>, + env_clear: bool, } #[derive(Clone)] @@ -36,7 +37,13 @@ impl Command { } fn _new(program: Program) -> Command { - Command { program, args: Vec::new(), env: Vec::new(), env_remove: Vec::new() } + Command { + program, + args: Vec::new(), + env: Vec::new(), + env_remove: Vec::new(), + env_clear: false, + } } pub(crate) fn arg<P: AsRef<OsStr>>(&mut self, arg: P) -> &mut Command { @@ -79,6 +86,11 @@ impl Command { self } + pub(crate) fn env_clear(&mut self) -> &mut Command { + self.env_clear = true; + self + } + fn _env_remove(&mut self, key: &OsStr) { self.env_remove.push(key.to_owned()); } @@ -106,6 +118,9 @@ impl Command { for k in &self.env_remove { ret.env_remove(k); } + if self.env_clear { + ret.env_clear(); + } ret } |
