about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
diff options
context:
space:
mode:
authorMichael Wörister <mworister@microsoft.com>2024-02-19 14:03:09 +0100
committerMichael Wörister <mworister@microsoft.com>2024-03-14 09:54:29 +0100
commit3c49fe0cbd86b452ba519ffe98ece4a620caee23 (patch)
tree5fd49bbe6bc6a25ca54ec6512cb06aac6672f8a1 /compiler/rustc_codegen_ssa/src/back
parent9ce37dc7290e60bd0dfc7a5d4fcdbbd836f989f0 (diff)
downloadrust-3c49fe0cbd86b452ba519ffe98ece4a620caee23.tar.gz
rust-3c49fe0cbd86b452ba519ffe98ece4a620caee23.zip
link.exe: don't embed full path to PDB file in binary.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/linker.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index b4e054417f3..65bff08d781 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -929,6 +929,15 @@ impl<'a> Linker for MsvcLinker<'a> {
                 // from the CodeView line tables in the object files.
                 self.cmd.arg("/DEBUG");
 
+                // Default to emitting only the file name of the PDB file into
+                // the binary instead of the full path. Emitting the full path
+                // may leak private information (such as user names).
+                // See https://github.com/rust-lang/rust/issues/87825.
+                //
+                // This default behavior can be overridden by explicitly passing
+                // `-Clink-arg=/PDBALTPATH:...` to rustc.
+                self.cmd.arg("/PDBALTPATH:%_PDB%");
+
                 // This will cause the Microsoft linker to embed .natvis info into the PDB file
                 let natvis_dir_path = self.sess.sysroot.join("lib\\rustlib\\etc");
                 if let Ok(natvis_dir) = fs::read_dir(&natvis_dir_path) {