[clang-cl] Always interpret the LIB env var as separated with semicolons
authorMartin Storsjö <martin@martin.st>
Sun, 20 Sep 2020 20:19:12 +0000 (23:19 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 21 Sep 2020 20:42:59 +0000 (23:42 +0300)
commit4d85444b317a00a3e15da63cdb693d272c99a0cc
tree1b3b853d2de5e7c820b8a115253415b2a68a5abc
parentead7c3cdc34c63d8df78d8e333b7cc64d03236ea
[clang-cl] Always interpret the LIB env var as separated with semicolons

When cross compiling with clang-cl, clang splits the INCLUDE env
variable around semicolons (clang/lib/Driver/ToolChains/MSVC.cpp,
MSVCToolChain::AddClangSystemIncludeArgs) and lld splits the
LIB variable similarly (lld/COFF/Driver.cpp,
LinkerDriver::addLibSearchPaths). Therefore, the consensus for
cross compilation with clang-cl and lld-link seems to be to use
semicolons, despite path lists normally being separated by colons
on unix and EnvPathSeparator being set to that.

Therefore, handle the LIB variable similarly in Clang, when
handling lib file arguments when driving linking via Clang.

This fixes commands like "clang-cl test.c -Fetest.exe kernel32.lib" in
a cross compilation setting. Normally, most users call (lld-)link
directly, but meson happens to use this command syntax for
has_function() tests.

Differential Revision: https://reviews.llvm.org/D88002
clang/lib/Driver/Driver.cpp
clang/test/Driver/cl-inputs.c
llvm/include/llvm/Support/Process.h
llvm/lib/Support/Process.cpp