Skip to content

Commit 94d4c0e

Browse files
authored
Rollup merge of rust-lang#70682 - jclulow:illumos-libssp, r=nagisa
link with "libssp" on *-sun-solaris systems LLVM will insert calls to the stack protector functions "__stack_chk_fail" and "__stack_chk_guard" into code in native object files. Some platforms include these symbols directly in libc, but at least historically these have been provided in libssp.so on illumos and Solaris systems. Include "-lssp" in the arguments to the linker when building for those targets.
2 parents c966511 + d730bf9 commit 94d4c0e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/librustc_target/spec/solaris_base.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
use crate::spec::TargetOptions;
1+
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
22
use std::default::Default;
33

44
pub fn opts() -> TargetOptions {
5+
let mut late_link_args = LinkArgs::new();
6+
late_link_args.insert(
7+
LinkerFlavor::Gcc,
8+
vec![
9+
// LLVM will insert calls to the stack protector functions
10+
// "__stack_chk_fail" and "__stack_chk_guard" into code in native
11+
// object files. Some platforms include these symbols directly in
12+
// libc, but at least historically these have been provided in
13+
// libssp.so on illumos and Solaris systems.
14+
"-lssp".to_string(),
15+
],
16+
);
17+
518
TargetOptions {
619
dynamic_linking: true,
720
executables: true,
821
has_rpath: true,
922
target_family: Some("unix".to_string()),
1023
is_like_solaris: true,
1124
limit_rdylib_exports: false, // Linker doesn't support this
25+
late_link_args,
1226

1327
..Default::default()
1428
}

0 commit comments

Comments
 (0)