Bootstrap: change logic for choosing linker and rpath
This commit is contained in:
@@ -980,7 +980,7 @@ impl<'a> Builder<'a> {
|
|||||||
// argument manually via `-C link-args=-Wl,-rpath,...`. Plus isn't it
|
// 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
|
// 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?
|
// 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") {
|
let rpath = if target.contains("apple") {
|
||||||
|
|
||||||
// Note that we need to take one extra step on macOS to also pass
|
// Note that we need to take one extra step on macOS to also pass
|
||||||
@@ -990,10 +990,7 @@ impl<'a> Builder<'a> {
|
|||||||
// flesh out rpath support more fully in the future.
|
// flesh out rpath support more fully in the future.
|
||||||
rustflags.arg("-Zosx-rpath-install-name");
|
rustflags.arg("-Zosx-rpath-install-name");
|
||||||
Some("-Wl,-rpath,@loader_path/../lib")
|
Some("-Wl,-rpath,@loader_path/../lib")
|
||||||
} else if !target.contains("windows") &&
|
} else if !target.contains("windows") {
|
||||||
!target.contains("wasm32") &&
|
|
||||||
!target.contains("emscripten") &&
|
|
||||||
!target.contains("fuchsia") {
|
|
||||||
Some("-Wl,-rpath,$ORIGIN/../lib")
|
Some("-Wl,-rpath,$ORIGIN/../lib")
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -806,12 +806,8 @@ impl Build {
|
|||||||
.and_then(|c| c.linker.as_ref()) {
|
.and_then(|c| c.linker.as_ref()) {
|
||||||
Some(linker)
|
Some(linker)
|
||||||
} else if target != self.config.build &&
|
} else if target != self.config.build &&
|
||||||
!target.contains("msvc") &&
|
util::use_host_linker(&target) &&
|
||||||
!target.contains("emscripten") &&
|
!target.contains("msvc") {
|
||||||
!target.contains("wasm32") &&
|
|
||||||
!target.contains("nvptx") &&
|
|
||||||
!target.contains("fortanix") &&
|
|
||||||
!target.contains("fuchsia") {
|
|
||||||
Some(self.cc(target))
|
Some(self.cc(target))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use build_helper::t;
|
|||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::builder::Builder;
|
use crate::builder::Builder;
|
||||||
|
use crate::cache::Interned;
|
||||||
|
|
||||||
/// Returns the `name` as the filename of a static library for `target`.
|
/// Returns the `name` as the filename of a static library for `target`.
|
||||||
pub fn staticlib(name: &str, target: &str) -> String {
|
pub fn staticlib(name: &str, target: &str) -> String {
|
||||||
@@ -306,3 +307,15 @@ pub fn forcing_clang_based_tests() -> bool {
|
|||||||
false
|
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")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user