forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#115120 - icedrocket:ignore-strip-on-msvc, r=m…
…ichaelwoerister Ignore `-C strip` on MSVC tl;dr - Define `-Cstrip` to only ever affect the binary; no other build artifacts. This is necessary to improve cross-platform behavior consistency: if someone wanted debug information to be contained only in separate files on all platforms, they would set `-Cstrip=symbols` and `-Csplit-debuginfo=packed`, but this would result in no PDB files on MSVC. Resolves rust-lang#114215
- Loading branch information
Showing
4 changed files
with
103 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//@ compile-flags: -C strip=debuginfo | ||
//@ only-msvc | ||
//@ run-pass | ||
|
||
use std::path::Path; | ||
|
||
pub fn is_related_pdb<P: AsRef<Path>>(path: &P, exe: &P) -> bool { | ||
let (exe, path) = (exe.as_ref(), path.as_ref()); | ||
|
||
path.extension() | ||
.map(|x| x.to_ascii_lowercase()) | ||
.is_some_and(|x| x == "pdb") | ||
&& path.file_stem() == exe.file_stem() | ||
} | ||
|
||
pub fn main() { | ||
let curr_exe = std::env::current_exe().unwrap(); | ||
let curr_dir = curr_exe.parent().unwrap(); | ||
|
||
let entries = std::fs::read_dir(curr_dir).unwrap(); | ||
|
||
assert!(entries | ||
.map_while(|x| x.ok()) | ||
.find(|x| is_related_pdb(&x.path(), &curr_exe)) | ||
.is_some()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//@ compile-flags: -C strip=symbols | ||
//@ only-msvc | ||
//@ run-pass | ||
|
||
use std::path::Path; | ||
|
||
pub fn is_related_pdb<P: AsRef<Path>>(path: &P, exe: &P) -> bool { | ||
let (exe, path) = (exe.as_ref(), path.as_ref()); | ||
|
||
path.extension() | ||
.map(|x| x.to_ascii_lowercase()) | ||
.is_some_and(|x| x == "pdb") | ||
&& path.file_stem() == exe.file_stem() | ||
} | ||
|
||
pub fn main() { | ||
let curr_exe = std::env::current_exe().unwrap(); | ||
let curr_dir = curr_exe.parent().unwrap(); | ||
|
||
let entries = std::fs::read_dir(curr_dir).unwrap(); | ||
|
||
assert!(entries | ||
.map_while(|x| x.ok()) | ||
.find(|x| is_related_pdb(&x.path(), &curr_exe)) | ||
.is_some()); | ||
} |