From 0577b60832627e774337456ecbb9bfc9dbb0b0fc Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 16 Oct 2017 03:20:01 +0300 Subject: [PATCH] Re-enable linker override for cross-compilation --- src/bootstrap/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 63dc17910f08a..6ac919d3fbdda 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -661,8 +661,9 @@ impl Build { /// Returns the path to the linker for the given target if it needs to be overriden. fn linker(&self, target: Interned) -> Option<&Path> { - if let Some(config) = self.config.target_config.get(&target) { - config.linker.as_ref().map(|p| &**p) + if let Some(linker) = self.config.target_config.get(&target) + .and_then(|c| c.linker.as_ref()) { + Some(linker) } else if target != self.config.build && !target.contains("msvc") && !target.contains("emscripten") { Some(self.cc(target))