Skip to content

Commit

Permalink
Merge pull request #142 from rust-secure-code/fix-msvc
Browse files Browse the repository at this point in the history
Use the correct link.exe flag for preserving the specified symbol even if it is unused
  • Loading branch information
Shnatsel authored Apr 28, 2024
2 parents 4d92c13 + 11a38fb commit a2e3ae4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cargo-auditable/src/rustc_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub fn main(rustc_path: &OsStr) {
// Prevent the symbol from being removed as unused by the linker
if target_triple.contains("-apple-") {
command.arg("-Clink-arg=-Wl,-u,_AUDITABLE_VERSION_INFO");
} else if target_triple.ends_with("-msvc") {
command.arg("-Clink-arg=/INCLUDE:AUDITABLE_VERSION_INFO");
} else {
command.arg("-Clink-arg=-Wl,--undefined=AUDITABLE_VERSION_INFO");
}
Expand Down

0 comments on commit a2e3ae4

Please sign in to comment.