Skip to content

Commit 55e63cd

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 beff7ca + fe68b1a commit 55e63cd

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
@@ -432,8 +432,6 @@ impl<'a> Linker for GccLinker<'a> {
432432
// insert it here.
433433
if self.sess.target.is_like_osx {
434434
self.linker_arg("-dead_strip");
435-
} else if self.sess.target.is_like_solaris {
436-
self.linker_arg("-zignore");
437435

438436
// If we're building a dylib, we don't use --gc-sections because LLVM
439437
// has already done the best it can do, and we also don't want to
@@ -655,6 +653,10 @@ impl<'a> Linker for GccLinker<'a> {
655653
fn add_as_needed(&mut self) {
656654
if self.sess.target.linker_is_gnu {
657655
self.linker_arg("--as-needed");
656+
} else if self.sess.target.is_like_solaris {
657+
// -z ignore is the Solaris equivalent to the GNU ld --as-needed option
658+
self.linker_arg("-z");
659+
self.linker_arg("ignore");
658660
}
659661
}
660662
}

0 commit comments

Comments
 (0)