Skip to content

Commit da482cc

Browse files
authored
Rollup merge of rust-lang#84468 - iladin:iladin/fix-84467, r=petrochenkov
Fix#84467 linker_args with --target=sparcv9-sun-solaris Trying to cross-compile for sparcv9-sun-solaris getting a error message for -zignore Introduced when -z -ignore was seperated here 22d0ab0 No formatting done Reproduce ``` bash rustup target add sparcv9-sun-solaris cargo new --bin hello && cd hello && cargo run --target=sparcv9-sun-solaris ``` config.toml [target.sparcv9-sun-solaris] linker = "gcc"
2 parents 4a32f99 + fe68b1a commit da482cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,6 @@ impl<'a> Linker for GccLinker<'a> {
462462
// insert it here.
463463
if self.sess.target.is_like_osx {
464464
self.linker_arg("-dead_strip");
465-
} else if self.sess.target.is_like_solaris {
466-
self.linker_arg("-zignore");
467465

468466
// If we're building a dylib, we don't use --gc-sections because LLVM
469467
// has already done the best it can do, and we also don't want to
@@ -695,6 +693,10 @@ impl<'a> Linker for GccLinker<'a> {
695693
fn add_as_needed(&mut self) {
696694
if self.sess.target.linker_is_gnu {
697695
self.linker_arg("--as-needed");
696+
} else if self.sess.target.is_like_solaris {
697+
// -z ignore is the Solaris equivalent to the GNU ld --as-needed option
698+
self.linker_arg("-z");
699+
self.linker_arg("ignore");
698700
}
699701
}
700702
}

0 commit comments

Comments
 (0)