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

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 12:48:11 PDT 2022


pcc created this revision.
pcc added a reviewer: thakis.
Herald added a project: All.
pcc requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123244

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


Index: llvm/utils/gn/build/toolchain/BUILD.gn
===================================================================
--- llvm/utils/gn/build/toolchain/BUILD.gn
+++ llvm/utils/gn/build/toolchain/BUILD.gn
@@ -198,7 +198,8 @@
       "//: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)" ]
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123244.420979.patch
Type: text/x-patch
Size: 528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220406/1b66d35f/attachment.bin>


More information about the llvm-commits mailing list