Skip to content

Commit

Permalink
[gn build] Use lld-link's new /winsysroot: flag
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nico committed Mar 21, 2022
1 parent 7678e8e commit 312ec6f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/utils/gn/build/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) ]
Expand Down

0 comments on commit 312ec6f

Please sign in to comment.