summaryrefslogtreecommitdiff
path: root/bootstrap/rust-1.75/0006-Link-libssp_nonshared.a-on-all-musl-targets.patch
blob: fd369e240aebe6243415974a32f983dd8f6f2623 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From f516ef748075ddfbcbaec493e1a7ee1e59538bd0 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sun, 3 Nov 2019 17:01:32 -0600
Subject: [PATCH 06/12] Link libssp_nonshared.a on all musl targets

---
 compiler/rustc_target/src/spec/base/linux_musl.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
index 36d64059d59ad..c113af2464423 100644
--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
@@ -1,10 +1,13 @@
-use crate::spec::{base, TargetOptions};
+use crate::spec::{base, Cc, LinkerFlavor, Lld, TargetOptions};
 
 pub fn opts() -> TargetOptions {
     let mut base = base::linux::opts();
 
     base.env = "musl".into();
 
+    // libssp_nonshared.a is needed for __stack_chk_fail_local when using libc.so
+    base.add_post_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-lssp_nonshared"]);
+
     // These targets statically link libc by default
     base.crt_static_default = true;