about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-09-15 09:56:11 +0000
committerbors <bors@rust-lang.org>2014-09-15 09:56:11 +0000
commit1f5ee97184db63196713cf05fe834e6f32537e30 (patch)
treeb9397b6fb4683cb19eba7394c72cd6dc7501a82e
parent3e7e2af4727e673f874355ccdab58e900f76bebd (diff)
parente9c4efb1bf00594c06bf694efe2f68c9633ed18b (diff)
downloadrust-1f5ee97184db63196713cf05fe834e6f32537e30.tar.gz
rust-1f5ee97184db63196713cf05fe834e6f32537e30.zip
auto merge of #17192 : skade/rust/fix-osx-linking, r=alexcrichton
Don't pass -fno-use-linker-plugin on OS X as clang does not accept it.

clang fails linking with:

```
error: linking with `cc` failed: exit code: 1
... arg list omitted...
note: clang: error: unknown argument: '-fno-use-linker-plugin' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
```

clang version:

```
$ clang -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
```
-rw-r--r--src/librustc/back/link.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 77a837bfbb1..cc4e47de007 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -931,7 +931,12 @@ fn link_args(cmd: &mut Command,
     }
 
     // Rust does its' own LTO
-    cmd.arg("-fno-lto").arg("-fno-use-linker-plugin");
+    cmd.arg("-fno-lto");
+
+    // clang fails hard if -fno-use-linker-plugin is passed
+    if sess.targ_cfg.os == abi::OsWindows {
+        cmd.arg("-fno-use-linker-plugin");
+    }
 
     // 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 eliminate the