diff --git a/llvm/utils/gn/secondary/BUILD.gn b/llvm/utils/gn/secondary/BUILD.gn --- a/llvm/utils/gn/secondary/BUILD.gn +++ b/llvm/utils/gn/secondary/BUILD.gn @@ -8,6 +8,7 @@ "//clang-tools-extra/test", "//clang/test", "//clang/tools/scan-build", + "//compiler-rt", "//compiler-rt/include", "//compiler-rt/lib/scudo", "//lld/test", diff --git a/llvm/utils/gn/secondary/compiler-rt/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/BUILD.gn --- a/llvm/utils/gn/secondary/compiler-rt/BUILD.gn +++ b/llvm/utils/gn/secondary/compiler-rt/BUILD.gn @@ -5,7 +5,11 @@ # 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. -supported_toolchains = [ "//llvm/utils/gn/build/toolchain:stage2_unix" ] +if (current_os == "win") { + supported_toolchains = [ "//llvm/utils/gn/build/toolchain: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", diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn --- a/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn +++ b/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn @@ -1,8 +1,10 @@ group("lib") { - deps = [ - "//compiler-rt/lib/asan", - "//compiler-rt/lib/builtins", - "//compiler-rt/lib/profile", - "//compiler-rt/lib/tsan", - ] + deps = [ "//compiler-rt/lib/profile" ] + if (current_os != "win") { + deps += [ + "//compiler-rt/lib/asan", + "//compiler-rt/lib/builtins", + "//compiler-rt/lib/tsan", + ] + } } diff --git a/llvm/utils/gn/secondary/compiler-rt/target.gni b/llvm/utils/gn/secondary/compiler-rt/target.gni --- a/llvm/utils/gn/secondary/compiler-rt/target.gni +++ b/llvm/utils/gn/secondary/compiler-rt/target.gni @@ -28,6 +28,9 @@ } } 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) }