[PATCH] D121871: [gn build] Use lld-link's new /winsysroot: flag
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 17:34:24 PDT 2022
thakis created this revision.
thakis added a reviewer: aeubanks.
Herald added a project: All.
thakis requested review of this revision.
Herald added a project: LLVM.
If `clang_base_path` is set, it must now point to a directory that contains
an lld-link built with D118070 <https://reviews.llvm.org/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.)
https://reviews.llvm.org/D121871
Files:
llvm/utils/gn/build/BUILD.gn
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -297,6 +297,12 @@
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) ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121871.416033.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220317/80b1a989/attachment.bin>
More information about the llvm-commits
mailing list