From 1e76a0e9971d1ea58a1a3101632ff7163d579673 Mon Sep 17 00:00:00 2001 From: erjuan Date: Tue, 12 Nov 2024 16:40:10 +0800 Subject: [PATCH] fix windows build fail in stack-protector fix windows build fail in stack-protector Signed-off-by: fengting --- compiler/rustc_target/src/spec/windows_gnu_base.rs | 2 ++ compiler/rustc_target/src/spec/windows_gnullvm_base.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/windows_gnu_base.rs b/compiler/rustc_target/src/spec/windows_gnu_base.rs index 2231983f071..2cb115e37f2 100644 --- a/compiler/rustc_target/src/spec/windows_gnu_base.rs +++ b/compiler/rustc_target/src/spec/windows_gnu_base.rs @@ -41,6 +41,8 @@ pub fn opts() -> TargetOptions { "-lmsvcrt", "-luser32", "-lkernel32", + "-lssp_nonshared", + "-lssp", ]; let mut late_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs); diff --git a/compiler/rustc_target/src/spec/windows_gnullvm_base.rs b/compiler/rustc_target/src/spec/windows_gnullvm_base.rs index b1d8e2be5a6..c9a589851e6 100644 --- a/compiler/rustc_target/src/spec/windows_gnullvm_base.rs +++ b/compiler/rustc_target/src/spec/windows_gnullvm_base.rs @@ -13,7 +13,7 @@ pub fn opts() -> TargetOptions { // Order of `late_link_args*` does not matter with LLD. let late_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::Yes, Lld::No), - &["-lmingw32", "-lmingwex", "-lmsvcrt", "-lkernel32", "-luser32"], + &["-lmingw32", "-lmingwex", "-lmsvcrt", "-lkernel32", "-luser32", "-lssp_nonshared", "-lssp"], ); TargetOptions { -- Gitee