[llvm] 312ec6f - [gn build] Use lld-link's new /winsysroot: flag
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 10:43:49 PDT 2022
Author: Nico Weber
Date: 2022-03-21T13:43:38-04:00
New Revision: 312ec6f1569e04d16bb474a78a5f61b0ca5ffb22
URL: https://github.com/llvm/llvm-project/commit/312ec6f1569e04d16bb474a78a5f61b0ca5ffb22
DIFF: https://github.com/llvm/llvm-project/commit/312ec6f1569e04d16bb474a78a5f61b0ca5ffb22.diff
LOG: [gn build] Use lld-link's new /winsysroot: flag
If `clang_base_path` is set, it must now point to a directory that contains
an lld-link built with D118070.
(If this is a problem for anyone, we can guard this behind a
lld_link_understands_winsysroot gn arg, but let's see if we can get away
without that for now.)
With this, it's possible to build everything in a normal cmd.exe Window,
an MSVC shell isn't needed \o/
(Assuming you set `clang_base_path`, and you set `sysroot` to a directory
that contains a win sysroot. If you have MSVC installed,
`python3 llvm\utils\sysroot.py make-fake --out-dir=my-sysroot` and
setting `sysroot = "//my-sysroot"` in args.gn works, for example.)
Differential Revision: https://reviews.llvm.org/D121871
Added:
Modified:
llvm/utils/gn/build/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index f539adacf805d..df0171ce544b4 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -297,6 +297,12 @@ config("compiler_defaults") {
if (current_os == "win") {
assert(is_clang, "sysroot only works with clang-cl as host compiler")
cflags += [ "/winsysroot" + rebase_path(sysroot, root_build_dir) ]
+ if (use_lld) {
+ ldflags += [ "/winsysroot:" + rebase_path(sysroot, root_build_dir) ]
+
+ # FIXME: Remove once PR54409 is fixed.
+ ldflags += [ "/machine:x64" ]
+ }
} else if (current_os != "ios" && current_os != "mac" &&
current_os != "android") {
cflags += [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ]
More information about the llvm-commits
mailing list