about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-10-15 21:39:16 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-10-15 23:23:28 +0300
commit89d9ce4ec3c134ab62e9eea18a9620face8f88b7 (patch)
tree896be050a00cdc09702c823891d2d2c0a116e0a2 /src/bootstrap/lib.rs
parent9e0fc5ccd050201e77483b1efb2e6c76f47496f6 (diff)
downloadrust-89d9ce4ec3c134ab62e9eea18a9620face8f88b7.tar.gz
rust-89d9ce4ec3c134ab62e9eea18a9620face8f88b7.zip
Don't use target's linker when linking build scripts
Diffstat (limited to 'src/bootstrap/lib.rs')
-rw-r--r--src/bootstrap/lib.rs30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 7c599f91838..63dc17910f0 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -649,10 +649,6 @@ impl Build {
         self.ar.get(&target).map(|p| &**p)
     }
 
-    fn linker(&self, target: Interned<String>) -> Option<&Path> {
-        self.config.target_config.get(&target).and_then(|c| c.linker.as_ref().map(|p| &**p))
-    }
-
     /// Returns the path to the C++ compiler for the target specified.
     fn cxx(&self, target: Interned<String>) -> Result<&Path, String> {
         match self.cxx.get(&target) {
@@ -663,24 +659,16 @@ impl Build {
         }
     }
 
-    /// Returns flags to pass to the compiler to generate code for `target`.
-    fn rustc_flags(&self, target: Interned<String>) -> Vec<String> {
-        // New flags should be added here with great caution!
-        //
-        // It's quite unfortunate to **require** flags to generate code for a
-        // target, so it should only be passed here if absolutely necessary!
-        // Most default configuration should be done through target specs rather
-        // than an entry here.
-
-        let mut base = Vec::new();
-        if let Some(linker) = self.linker(target) {
-            // If linker was explictly provided, force it on all the compiled Rust code.
-            base.push(format!("-Clinker={}", linker.display()));
-        } else if target != self.config.build && !target.contains("msvc") &&
-            !target.contains("emscripten") {
-            base.push(format!("-Clinker={}", self.cc(target).display()));
+    /// Returns the path to the linker for the given target if it needs to be overriden.
+    fn linker(&self, target: Interned<String>) -> Option<&Path> {
+        if let Some(config) = self.config.target_config.get(&target) {
+            config.linker.as_ref().map(|p| &**p)
+        } else if target != self.config.build &&
+                  !target.contains("msvc") && !target.contains("emscripten") {
+            Some(self.cc(target))
+        } else {
+            None
         }
-        base
     }
 
     /// Returns if this target should statically link the C runtime, if specified