// argument manually via `-C link-args=-Wl,-rpath,...`. Plus isn't it
// fun to pass a flag to a tool to pass a flag to pass a flag to a tool
// to change a flag in a binary?
- if self.config.rust_rpath {
+ if self.config.rust_rpath && util::use_host_linker(&target) {
let rpath = if target.contains("apple") {
// Note that we need to take one extra step on macOS to also pass
// flesh out rpath support more fully in the future.
rustflags.arg("-Zosx-rpath-install-name");
Some("-Wl,-rpath,@loader_path/../lib")
- } else if !target.contains("windows") &&
- !target.contains("wasm32") &&
- !target.contains("emscripten") &&
- !target.contains("fuchsia") {
+ } else if !target.contains("windows") {
Some("-Wl,-rpath,$ORIGIN/../lib")
} else {
None
.and_then(|c| c.linker.as_ref()) {
Some(linker)
} else if target != self.config.build &&
- !target.contains("msvc") &&
- !target.contains("emscripten") &&
- !target.contains("wasm32") &&
- !target.contains("nvptx") &&
- !target.contains("fortanix") &&
- !target.contains("fuchsia") {
+ util::use_host_linker(&target) &&
+ !target.contains("msvc") {
Some(self.cc(target))
} else {
None
use crate::config::Config;
use crate::builder::Builder;
+use crate::cache::Interned;
/// Returns the `name` as the filename of a static library for `target`.
pub fn staticlib(name: &str, target: &str) -> String {
false
}
}
+
+pub fn use_host_linker(target: &Interned<String>) -> bool {
+ // FIXME: this information should be gotten by checking the linker flavor
+ // of the rustc target
+ !(
+ target.contains("emscripten") ||
+ target.contains("wasm32") ||
+ target.contains("nvptx") ||
+ target.contains("fortanix") ||
+ target.contains("fuchsia")
+ )
+}