[llvm] r352415 - gn build: Fix `lld-link: unknown flag: -fuse-ld=lld` warnings on Windows

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 28 11:32:53 PST 2019


Author: nico
Date: Mon Jan 28 11:32:52 2019
New Revision: 352415

URL: http://llvm.org/viewvc/llvm-project?rev=352415&view=rev
Log:
gn build: Fix `lld-link: unknown flag: -fuse-ld=lld` warnings on Windows

Fixes a minor regression from r351248.

While here, also make it possible to opt out of lld by saying
use_lld=false when clang_base_path is set. (use_lld still defaults to
true if clang_base_path is set.)

Modified:
    llvm/trunk/utils/gn/build/BUILD.gn
    llvm/trunk/utils/gn/build/toolchain/BUILD.gn

Modified: llvm/trunk/utils/gn/build/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/BUILD.gn?rev=352415&r1=352414&r2=352415&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/BUILD.gn (original)
+++ llvm/trunk/utils/gn/build/BUILD.gn Mon Jan 28 11:32:52 2019
@@ -122,7 +122,8 @@ config("compiler_defaults") {
     }
   }
 
-  if (use_lld) {
+  # On Windows, the linker is not invoked through the compiler driver.
+  if (use_lld && host_os != "win") {
     ldflags += [ "-fuse-ld=lld" ]
   }
 }

Modified: llvm/trunk/utils/gn/build/toolchain/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/toolchain/BUILD.gn?rev=352415&r1=352414&r2=352415&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/toolchain/BUILD.gn (original)
+++ llvm/trunk/utils/gn/build/toolchain/BUILD.gn Mon Jan 28 11:32:52 2019
@@ -197,7 +197,9 @@ toolchain("win") {
 
   if (clang_base_path != "") {
     cl = "$clang_base_path/bin/clang-cl"
-    link = "$clang_base_path/bin/lld-link"
+    if (use_lld) {
+      link = "$clang_base_path/bin/lld-link"
+    }
   }
 
   if (use_goma) {




More information about the llvm-commits mailing list