about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-09-29 15:06:55 +0000
committerbors <bors@rust-lang.org>2025-09-29 15:06:55 +0000
commitdc2c3564d273cf8ccce32dc4f47eaa27063bceb9 (patch)
treee239ceac40bcb75cf372c798d5e901da385bbf51 /src/tools
parent21a13b8864a7dd614e9a96afd57b58c7fcf0bd6b (diff)
parenteb3fb457f14c419b58fc8b20d72efcea94e06d9f (diff)
downloadrust-dc2c3564d273cf8ccce32dc4f47eaa27063bceb9.tar.gz
rust-dc2c3564d273cf8ccce32dc4f47eaa27063bceb9.zip
Auto merge of #146376 - durin42:dwo-specify-path, r=davidtwco
debuginfo: add an unstable flag to write split DWARF to an explicit directory

Bazel requires knowledge of outputs from actions at analysis time, including file or directory name. In order to work around the lack of predictable output name for dwo files, we group the dwo files in a subdirectory of --out-dir as a post-processing step before returning control to bazel. Unfortunately some debugging workflows rely on directly opening the dwo file rather than loading the merged dwp file, and our trick of moving the files breaks those users. We can't just hardlink the file or copy it, because with remote build execution we wouldn't end up with the un-moved file copied back to the developer's workstation. As a fix, we add this unstable flag that causes dwo files to be written to a build-system-controllable location, which then lets bazel hoover up the dwo files, but the objects also have the correct path for the dwo files.

r? `@davidtwco`
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/run-make-support/src/external_deps/rustc.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/run-make-support/src/external_deps/rustc.rs b/src/tools/run-make-support/src/external_deps/rustc.rs
index b74b1d5e166..b461a24a061 100644
--- a/src/tools/run-make-support/src/external_deps/rustc.rs
+++ b/src/tools/run-make-support/src/external_deps/rustc.rs
@@ -366,6 +366,13 @@ impl Rustc {
         self
     }
 
+    pub fn split_dwarf_out_dir(&mut self, out_dir: Option<&str>) -> &mut Self {
+        if let Some(out_dir) = out_dir {
+            self.cmd.arg(format!("-Zsplit-dwarf-out-dir={out_dir}"));
+        }
+        self
+    }
+
     /// Pass the `--verbose` flag.
     pub fn verbose(&mut self) -> &mut Self {
         self.cmd.arg("--verbose");