[gn build] Support compiler-rt/profile on Windows

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D101961
This commit is contained in:
Arthur Eubanks 2021-05-05 16:35:14 -07:00
parent 71eb32d97e
commit 642df18f14
5 changed files with 142 additions and 111 deletions

View File

@ -239,7 +239,14 @@ if (host_os == "mac") {
}
}
toolchain("win") {
template("win_toolchain") {
toolchain(target_name) {
# https://groups.google.com/a/chromium.org/d/msg/gn-dev/F_lv5T-tNDM
forward_variables_from(invoker.toolchain_args, "*")
not_needed("*")
forward_variables_from(invoker, "*")
cl = "cl"
link = "link"
@ -343,9 +350,26 @@ toolchain("win") {
command = "cmd /c type nul > {{output}}"
description = "STAMP {{output}}"
}
}
}
win_toolchain("win") {
toolchain_args = {
current_os = "win"
current_cpu = host_cpu
}
}
win_toolchain("stage2_win") {
toolchain_args = {
current_os = host_os
current_cpu = host_cpu
clang_base_path = root_build_dir
use_goma = false
}
deps = [
"//:clang($host_toolchain)",
"//:lld($host_toolchain)",
]
}

View File

@ -8,14 +8,12 @@ group("default") {
"//clang-tools-extra/test",
"//clang/test",
"//clang/tools/scan-build",
"//compiler-rt",
"//compiler-rt/include",
"//compiler-rt/lib/scudo",
"//lld/test",
"//llvm/test",
]
if (current_os == "linux" || current_os == "mac") {
deps += [ "//compiler-rt" ]
}
if (current_os == "linux") {
deps += [
"//libcxx",

View File

@ -5,7 +5,11 @@ import("//llvm/utils/gn/build/toolchain/compiler.gni")
# In the GN build, compiler-rt is always built by just-built clang and lld.
# FIXME: For macOS and iOS builds, depend on lib in all needed target arch
# toolchains and then lipo them together for the final output.
if (current_os == "win") {
supported_toolchains = [ "//llvm/utils/gn/build/toolchain:stage2_win" ]
} else {
supported_toolchains = [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
}
if (android_ndk_path != "") {
supported_toolchains += [
"//llvm/utils/gn/build/toolchain:stage2_android_aarch64",

View File

@ -1,8 +1,10 @@
group("lib") {
deps = [
deps = [ "//compiler-rt/lib/profile" ]
if (current_os != "win") {
deps += [
"//compiler-rt/lib/asan",
"//compiler-rt/lib/builtins",
"//compiler-rt/lib/profile",
"//compiler-rt/lib/tsan",
]
}
}

View File

@ -28,6 +28,9 @@ if (clang_enable_per_target_runtime_dir) {
}
} else if (current_os == "ios" || current_os == "mac") {
crt_current_out_dir = "$clang_resource_dir/lib/darwin"
} else if (current_os == "win") {
crt_current_out_dir = "$clang_resource_dir/lib/windows"
crt_current_target_suffix = "-$crt_current_target_arch"
} else {
assert(false, "unimplemented current_os " + current_os)
}