Skip to content

Commit

Permalink
Rollup merge of rust-lang#84468 - iladin:iladin/fix-84467, r=petroche…
Browse files Browse the repository at this point in the history
…nkov

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"
  • Loading branch information
Dylan-DPC committed May 4, 2021
2 parents eb45cff + fe68b1a commit 6120214
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,6 @@ impl<'a> Linker for GccLinker<'a> {
// insert it here.
if self.sess.target.is_like_osx {
self.linker_arg("-dead_strip");
} else if self.sess.target.is_like_solaris {
self.linker_arg("-zignore");

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

0 comments on commit 6120214

Please sign in to comment.