[llvm] 096477e - gn build: Use target OS to control whether to use/depend on llvm-ar.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 13:49:37 PDT 2022


Author: Peter Collingbourne
Date: 2022-04-06T13:45:40-07:00
New Revision: 096477e25e440ca923703750c628c862cd2a876c

URL: https://github.com/llvm/llvm-project/commit/096477e25e440ca923703750c628c862cd2a876c
DIFF: https://github.com/llvm/llvm-project/commit/096477e25e440ca923703750c628c862cd2a876c.diff

LOG: gn build: Use target OS to control whether to use/depend on llvm-ar.

When cross-compiling from Mac to non-Mac, we need to use the just-built
llvm-ar instead of libtool. We're currently doing the right thing
when determining which archiver command to use, but the path to ar
and the toolchain dependencies were being set based on the host OS
(current_os evaluated in host OS toolchain), instead of the target
OS. Fix the problem by looking up current_os inside toolchain_args.

Differential Revision: https://reviews.llvm.org/D123244

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index f48f25c4ca341..864ae45a88ca9 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -198,7 +198,8 @@ template("stage2_unix_toolchain") {
       "//:clang($host_toolchain)",
       "//:lld($host_toolchain)",
     ]
-    if (current_os != "ios" && current_os != "mac") {
+    if (toolchain_args.current_os != "ios" &&
+        toolchain_args.current_os != "mac") {
       ar = "bin/llvm-ar"
       deps += [ "//:llvm-ar($host_toolchain)" ]
     }


        


More information about the llvm-commits mailing list