gn build: Use target OS to control whether to use/depend on llvm-ar.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Apr 2022 19:46:05 +0000 (12:46 -0700)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Apr 2022 20:45:40 +0000 (13:45 -0700)
commit096477e25e440ca923703750c628c862cd2a876c
tree7e7db2394e2d973a98dc69595d85f3362fb92e4e
parent6795f37c1481d702e60e17b9d8e0b98faab979ca
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
llvm/utils/gn/build/toolchain/BUILD.gn