From 11a38fb315fefb09e7a8134a5e89ead1b15916af Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Sun, 28 Apr 2024 10:48:08 +0100 Subject: [PATCH] Use the correct link.exe flag for preserving the specified symbol even if it is unused --- cargo-auditable/src/rustc_wrapper.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cargo-auditable/src/rustc_wrapper.rs b/cargo-auditable/src/rustc_wrapper.rs index ac08616..9c07655 100644 --- a/cargo-auditable/src/rustc_wrapper.rs +++ b/cargo-auditable/src/rustc_wrapper.rs @@ -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"); }