From 44501bf5eb499b78ac900eb092f36856fbde078d Mon Sep 17 00:00:00 2001 From: David Vo Date: Tue, 9 Jun 2026 12:20:03 +1000 Subject: [PATCH] [bazel] Update rules_cc with patches (#8969) @AustinSchuh's `rules_cc` patches have all been merged upstream. This updates `rules_cc` to include the relevant patches, removing the need to patch it here. This also squashes this warning on every build: > WARNING: For repository 'rules_cc', the root module requires module version rules_cc@0.2.13, but got rules_cc@0.2.14 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off --- MODULE.bazel | 13 +- MODULE.bazel.lock | 5 +- shared/bazel/patches/rules_cc_windows.patch | 536 -------------------- 3 files changed, 4 insertions(+), 550 deletions(-) delete mode 100644 shared/bazel/patches/rules_cc_windows.patch diff --git a/MODULE.bazel b/MODULE.bazel index 23911b1f2d..23090bac1b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,18 +8,7 @@ include("//docs:doxygen.MODULE.bazel") include("//shared/bazel/thirdparty/mrclib:mrclib.MODULE.bazel") bazel_dep(name = "apple_support", version = "2.0.0", repo_name = "build_bazel_apple_support") - -# TODO(austin): Upgrade when the patches land. -# https://github.com/bazelbuild/rules_cc/pull/430 -# https://github.com/bazelbuild/rules_cc/pull/431 -# https://github.com/bazelbuild/rules_cc/pull/432 -bazel_dep(name = "rules_cc", version = "0.2.13") -single_version_override( - module_name = "rules_cc", - patch_strip = 1, - patches = ["//:shared/bazel/patches/rules_cc_windows.patch"], -) - +bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "rules_pkg", version = "1.1.0") bazel_dep(name = "bazel_features", version = "1.33.0") bazel_dep(name = "aspect_bazel_lib", version = "2.14.0") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index acde3d9772..9ab9dbcda4 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -117,7 +117,8 @@ "https://bcr.bazel.build/modules/rules_cc/0.2.0/MODULE.bazel": "b5c17f90458caae90d2ccd114c81970062946f49f355610ed89bebf954f5783c", "https://bcr.bazel.build/modules/rules_cc/0.2.13/MODULE.bazel": "eecdd666eda6be16a8d9dc15e44b5c75133405e820f620a234acc4b1fdc5aa37", "https://bcr.bazel.build/modules/rules_cc/0.2.14/MODULE.bazel": "353c99ed148887ee89c54a17d4100ae7e7e436593d104b668476019023b58df8", - "https://bcr.bazel.build/modules/rules_cc/0.2.14/source.json": "55d0a4587c5592fad350f6e698530f4faf0e7dd15e69d43f8d87e220c78bea54", + "https://bcr.bazel.build/modules/rules_cc/0.2.17/MODULE.bazel": "1849602c86cb60da8613d2de887f9566a6d354a6df6d7009f9d04a14402f9a84", + "https://bcr.bazel.build/modules/rules_cc/0.2.17/source.json": "3832f45d145354049137c0090df04629d9c2b5493dc5c2bf46f1834040133a07", "https://bcr.bazel.build/modules/rules_cc/0.2.8/MODULE.bazel": "f1df20f0bf22c28192a794f29b501ee2018fa37a3862a1a2132ae2940a23a642", "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", @@ -236,7 +237,7 @@ }, "@@rules_apple+//apple:apple.bzl%provisioning_profile_repository_extension": { "general": { - "bzlTransitiveDigest": "D1LPRZW/AxccDtwiSIAzTPVkOCIgLVT6zYQHYG7g9u4=", + "bzlTransitiveDigest": "JNyWptXQtF/Vu+dUIk3wLLXiS47h7sDP2eYWSsD28xU=", "usagesDigest": "vsJl8Rw5NL+5Ag2wdUDoTeRF/5klkXO8545Iy7U1Q08=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, diff --git a/shared/bazel/patches/rules_cc_windows.patch b/shared/bazel/patches/rules_cc_windows.patch deleted file mode 100644 index 29d83eca11..0000000000 --- a/shared/bazel/patches/rules_cc_windows.patch +++ /dev/null @@ -1,536 +0,0 @@ -diff --git a/cc/private/toolchain/BUILD.tpl b/cc/private/toolchain/BUILD.tpl -index 522d67e..afc8a25 100644 ---- a/cc/private/toolchain/BUILD.tpl -+++ b/cc/private/toolchain/BUILD.tpl -@@ -115,6 +115,7 @@ cc_toolchain_config( - opt_compile_flags = [%{opt_compile_flags}], - dbg_compile_flags = [%{dbg_compile_flags}], - conly_flags = [%{conly_flags}], -+ c_flags = [%{c_flags}], - cxx_flags = [%{cxx_flags}], - link_flags = [%{link_flags}], - link_libs = [%{link_libs}], -diff --git a/cc/private/toolchain/BUILD.windows.tpl b/cc/private/toolchain/BUILD.windows.tpl -index 1d0f8a0..b36212f 100644 ---- a/cc/private/toolchain/BUILD.windows.tpl -+++ b/cc/private/toolchain/BUILD.windows.tpl -@@ -124,6 +124,11 @@ cc_toolchain_config( - cxx_builtin_include_directories = [%{cxx_builtin_include_directories}], - tool_paths = {%{tool_paths}}, - tool_bin_path = "%{tool_bin_path}", -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -170,6 +175,11 @@ cc_toolchain_config( - tool_bin_path = "%{tool_bin_path}", - default_compile_flags = ["-m32"], - default_link_flags = ["-m32"], -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -214,6 +224,11 @@ cc_toolchain_config( - tool_bin_path = "%{mingw_tool_bin_path}", - cxx_builtin_include_directories = [%{mingw_cxx_builtin_include_directories}], - tool_paths = {%{mingw_tool_paths}}, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -260,6 +275,11 @@ cc_toolchain_config( - tool_paths = {%{mingw_tool_paths}}, - default_compile_flags = ["-m32"], - default_link_flags = ["-m32"], -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -331,6 +351,11 @@ cc_toolchain_config( - fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag_x64}", - supports_parse_showincludes = %{msvc_parse_showincludes_x64}, - shorten_virtual_includes = True, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -401,6 +426,11 @@ cc_toolchain_config( - fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag_x86}", - supports_parse_showincludes = %{msvc_parse_showincludes_x86}, - shorten_virtual_includes = True, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -471,6 +501,11 @@ cc_toolchain_config( - fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag_arm}", - supports_parse_showincludes = %{msvc_parse_showincludes_arm}, - shorten_virtual_includes = True, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -541,6 +576,11 @@ cc_toolchain_config( - fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag_arm64}", - supports_parse_showincludes = %{msvc_parse_showincludes_arm64}, - shorten_virtual_includes = True, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -608,6 +648,11 @@ cc_toolchain_config( - dbg_mode_debug_flag = "%{clang_cl_dbg_mode_debug_flag_x64}", - fastbuild_mode_debug_flag = "%{clang_cl_fastbuild_mode_debug_flag_x64}", - supports_parse_showincludes = %{clang_cl_parse_showincludes_x64}, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -@@ -676,6 +721,11 @@ cc_toolchain_config( - dbg_mode_debug_flag = "%{clang_cl_dbg_mode_debug_flag_arm64}", - fastbuild_mode_debug_flag = "%{clang_cl_fastbuild_mode_debug_flag_arm64}", - supports_parse_showincludes = %{clang_cl_parse_showincludes_arm64}, -+ c_flags = [%{c_flags}], -+ conly_flags = [%{conly_flags}], -+ cxx_flags = [%{cxx_flags}], -+ link_flags = [%{link_flags}], -+ win32_winnt_flag = "%{win32_winnt_flag}", - ) - - toolchain( -diff --git a/cc/private/toolchain/BUILD.windows_toolchains.tpl b/cc/private/toolchain/BUILD.windows_toolchains.tpl -new file mode 100644 -index 0000000..63f5b6d ---- /dev/null -+++ b/cc/private/toolchain/BUILD.windows_toolchains.tpl -@@ -0,0 +1,34 @@ -+load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS") -+ -+toolchain( -+ name = "cc-toolchain-arm64_windows", -+ exec_compatible_with = HOST_CONSTRAINTS, -+ target_compatible_with = [ -+ "@platforms//cpu:arm64", -+ "@platforms//os:windows", -+ ], -+ toolchain = "@local_config_cc//:cc-compiler-arm64_windows", -+ toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", -+) -+ -+toolchain( -+ name = "cc-toolchain-x64_windows", -+ exec_compatible_with = HOST_CONSTRAINTS, -+ target_compatible_with = [ -+ "@platforms//cpu:x86_64", -+ "@platforms//os:windows", -+ ], -+ toolchain = "@local_config_cc//:cc-compiler-x64_windows", -+ toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", -+) -+ -+toolchain( -+ name = "cc-toolchain-armeabi-v7a", -+ exec_compatible_with = HOST_CONSTRAINTS, -+ target_compatible_with = [ -+ "@platforms//cpu:armv7", -+ "@platforms//os:android", -+ ], -+ toolchain = "@local_config_cc//:cc-compiler-armeabi-v7a", -+ toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", -+) -diff --git a/cc/private/toolchain/cc_configure.bzl b/cc/private/toolchain/cc_configure.bzl -index ce0dac5..ec68ab9 100644 ---- a/cc/private/toolchain/cc_configure.bzl -+++ b/cc/private/toolchain/cc_configure.bzl -@@ -33,12 +33,17 @@ def cc_autoconf_toolchains_impl(repository_ctx): - should_detect_cpp_toolchain = "BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN" not in env or env["BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN"] != "1" - - if should_detect_cpp_toolchain: -+ if repository_ctx.os.name.lower().find("windows") != -1: -+ build_path = "@rules_cc//cc/private/toolchain:BUILD.windows_toolchains.tpl" -+ else: -+ build_path = "@rules_cc//cc/private/toolchain:BUILD.toolchains.tpl" - paths = resolve_labels(repository_ctx, [ -- "@rules_cc//cc/private/toolchain:BUILD.toolchains.tpl", -+ build_path, - ]) -+ - repository_ctx.template( - "BUILD", -- paths["@rules_cc//cc/private/toolchain:BUILD.toolchains.tpl"], -+ paths[build_path], - {"%{name}": get_cpu_value(repository_ctx)}, - ) - else: -@@ -113,6 +118,7 @@ cc_autoconf = repository_rule( - "BAZEL_COMPILER", - "BAZEL_HOST_SYSTEM", - "BAZEL_CONLYOPTS", -+ "BAZEL_COPTS", - "BAZEL_CXXOPTS", - "BAZEL_LINKOPTS", - "BAZEL_LINKLIBS", -@@ -125,6 +131,7 @@ cc_autoconf = repository_rule( - "BAZEL_TARGET_SYSTEM", - "BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN", - "BAZEL_USE_LLVM_NATIVE_COVERAGE", -+ "BAZEL_WIN32_WINNT", - "BAZEL_LLVM", - "BAZEL_IGNORE_SYSTEM_HEADERS_VERSIONS", - "USE_CLANG_CL", -diff --git a/cc/private/toolchain/unix_cc_configure.bzl b/cc/private/toolchain/unix_cc_configure.bzl -index 6a6f38a..50270a1 100644 ---- a/cc/private/toolchain/unix_cc_configure.bzl -+++ b/cc/private/toolchain/unix_cc_configure.bzl -@@ -459,6 +459,12 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools): - }, - ) - -+ c_opts = split_escaped(get_env_var( -+ repository_ctx, -+ "BAZEL_COPTS", -+ "", -+ False, -+ ), ":") - conly_opts = split_escaped(get_env_var( - repository_ctx, - "BAZEL_CONLYOPTS", -@@ -662,6 +668,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools): - False, - )), - "%{conly_flags}": get_starlark_list(conly_opts), -+ "%{c_flags}": get_starlark_list(c_opts), - "%{coverage_compile_flags}": coverage_compile_flags, - "%{coverage_link_flags}": coverage_link_flags, - "%{cxx_builtin_include_directories}": get_starlark_list(builtin_include_directories), -diff --git a/cc/private/toolchain/unix_cc_toolchain_config.bzl b/cc/private/toolchain/unix_cc_toolchain_config.bzl -index e3bb775..5df9ed4 100644 ---- a/cc/private/toolchain/unix_cc_toolchain_config.bzl -+++ b/cc/private/toolchain/unix_cc_toolchain_config.bzl -@@ -416,6 +416,14 @@ def _impl(ctx): - ] if ctx.attr.opt_compile_flags else []), - with_features = [with_feature_set(features = ["opt"])], - ), -+ flag_set( -+ actions = all_compile_actions, -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.c_flags, -+ ), -+ ] if ctx.attr.c_flags else []), -+ ), - flag_set( - actions = [ACTION_NAMES.c_compile], - flag_groups = ([ -@@ -1949,6 +1957,7 @@ cc_toolchain_config = rule( - "compile_flags": attr.string_list(), - "compiler": attr.string(mandatory = True), - "conly_flags": attr.string_list(), -+ "c_flags": attr.string_list(), - "coverage_compile_flags": attr.string_list(), - "coverage_link_flags": attr.string_list(), - "cpu": attr.string(mandatory = True), -diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl -index 66ca5fb..7581ce7 100644 ---- a/cc/private/toolchain/windows_cc_configure.bzl -+++ b/cc/private/toolchain/windows_cc_configure.bzl -@@ -21,7 +21,9 @@ load( - "auto_configure_warning_maybe", - "escape_string", - "execute", -+ "get_starlark_list", - "resolve_labels", -+ "split_escaped", - "write_builtin_include_directory_paths", - ) - -@@ -848,6 +850,42 @@ def _get_msvc_deps_scanner_vars(repository_ctx, paths, template_vars, target_arc - "%{msvc_deps_scanner_wrapper_path_" + target_arch + "}": "msvc_deps_scanner_wrapper_" + target_arch + ".bat", - } - -+def _get_copts(repository_ctx): -+ """Get the variables we need to populate the msys/mingw toolchains.""" -+ conly_opts = split_escaped(_get_env_var( -+ repository_ctx, -+ "BAZEL_CONLYOPTS", -+ "", -+ ), ":") -+ c_opts = split_escaped(_get_env_var( -+ repository_ctx, -+ "BAZEL_COPTS", -+ "", -+ ), ":") -+ cxx_opts = split_escaped(_get_env_var( -+ repository_ctx, -+ "BAZEL_CXXOPTS", -+ "", -+ ), ":") -+ link_opts = split_escaped(_get_env_var( -+ repository_ctx, -+ "BAZEL_LINKOPTS", -+ "", -+ ), ":") -+ win32_winnt_opts = _get_env_var( -+ repository_ctx, -+ "BAZEL_WIN32_WINNT", -+ "/D_WIN32_WINNT=0x0601", -+ ) -+ copts_vars = { -+ "%{c_flags}": get_starlark_list(c_opts), -+ "%{conly_flags}": get_starlark_list(conly_opts), -+ "%{cxx_flags}": get_starlark_list(cxx_opts), -+ "%{link_flags}": get_starlark_list(link_opts), -+ "%{win32_winnt_flag}": escape_string(win32_winnt_opts), -+ } -+ return copts_vars -+ - def configure_windows_toolchain(repository_ctx): - """Configure C++ toolchain on Windows. - -@@ -882,6 +920,7 @@ def configure_windows_toolchain(repository_ctx): - template_vars.update(msvc_vars_x64) - template_vars.update(_get_clang_cl_vars(repository_ctx, paths, msvc_vars_x64, "x64")) - template_vars.update(_get_msys_mingw_vars(repository_ctx)) -+ template_vars.update(_get_copts(repository_ctx)) - template_vars.update(_get_msvc_vars(repository_ctx, paths, "x86", msvc_vars_x64)) - template_vars.update(_get_msvc_vars(repository_ctx, paths, "arm", msvc_vars_x64)) - msvc_vars_arm64 = _get_msvc_vars(repository_ctx, paths, "arm64", msvc_vars_x64) -diff --git a/cc/private/toolchain/windows_cc_toolchain_config.bzl b/cc/private/toolchain/windows_cc_toolchain_config.bzl -index 5d0d40f..c6e7f94 100644 ---- a/cc/private/toolchain/windows_cc_toolchain_config.bzl -+++ b/cc/private/toolchain/windows_cc_toolchain_config.bzl -@@ -88,6 +88,12 @@ all_link_actions = [ - ACTION_NAMES.cpp_link_nodeps_dynamic_library, - ] - -+lto_index_actions = [ -+ ACTION_NAMES.lto_index_for_executable, -+ ACTION_NAMES.lto_index_for_dynamic_library, -+ ACTION_NAMES.lto_index_for_nodeps_dynamic_library, -+] -+ - def _use_msvc_toolchain(ctx): - return ctx.attr.cpu in ["x64_windows", "arm64_windows"] and (ctx.attr.compiler == "msvc-cl" or ctx.attr.compiler == "clang-cl") - -@@ -579,7 +585,11 @@ def _impl(ctx): - ACTION_NAMES.cpp20_module_compile, - ACTION_NAMES.cpp20_module_codegen, - ], -- flag_groups = [ -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.c_flags, -+ ), -+ ] if ctx.attr.c_flags else []) + [ - flag_group( - flags = ["%{user_compile_flags}"], - iterate_over = "user_compile_flags", -@@ -587,6 +597,30 @@ def _impl(ctx): - ), - ], - ), -+ flag_set( -+ actions = [ACTION_NAMES.c_compile], -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.conly_flags, -+ ), -+ ] if ctx.attr.conly_flags else []), -+ ), -+ flag_set( -+ actions = [ -+ ACTION_NAMES.linkstamp_compile, -+ ACTION_NAMES.cpp_compile, -+ ACTION_NAMES.cpp_header_parsing, -+ ACTION_NAMES.cpp_module_compile, -+ ACTION_NAMES.cpp_module_codegen, -+ ACTION_NAMES.lto_backend, -+ ACTION_NAMES.clif_match, -+ ], -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.cxx_flags, -+ ), -+ ] if ctx.attr.cxx_flags else []), -+ ), - ], - ) - -@@ -725,6 +759,14 @@ def _impl(ctx): - ), - ], - ), -+ flag_set( -+ actions = all_link_actions + lto_index_actions, -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.link_flags, -+ ), -+ ] if ctx.attr.link_flags else []), -+ ), - ], - ) - -@@ -743,6 +785,21 @@ def _impl(ctx): - ], - ) - -+ default_compile_flags_list = [ -+ "/DNOMINMAX", -+ "/D_CRT_SECURE_NO_DEPRECATE", -+ "/D_CRT_SECURE_NO_WARNINGS", -+ "/bigobj", -+ "/Zm500", -+ "/EHsc", -+ "/wd4351", -+ "/wd4291", -+ "/wd4250", -+ "/wd4996", -+ ] -+ if ctx.attr.win32_winnt_flag: -+ default_compile_flags_list.append(ctx.attr.win32_winnt_flag) -+ - default_compile_flags_feature = feature( - name = "default_compile_flags", - enabled = True, -@@ -765,19 +822,7 @@ def _impl(ctx): - ], - flag_groups = [ - flag_group( -- flags = [ -- "/DNOMINMAX", -- "/D_WIN32_WINNT=0x0601", -- "/D_CRT_SECURE_NO_DEPRECATE", -- "/D_CRT_SECURE_NO_WARNINGS", -- "/bigobj", -- "/Zm500", -- "/EHsc", -- "/wd4351", -- "/wd4291", -- "/wd4250", -- "/wd4996", -- ], -+ flags = default_compile_flags_list, - ), - ], - ), -@@ -1555,7 +1600,11 @@ def _impl(ctx): - ACTION_NAMES.lto_backend, - ACTION_NAMES.clif_match, - ], -- flag_groups = [ -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.c_flags, -+ ), -+ ] if ctx.attr.c_flags else []) + [ - flag_group( - flags = ["%{user_compile_flags}"], - iterate_over = "user_compile_flags", -@@ -1563,6 +1612,30 @@ def _impl(ctx): - ), - ], - ), -+ flag_set( -+ actions = [ACTION_NAMES.c_compile], -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.conly_flags, -+ ), -+ ] if ctx.attr.conly_flags else []), -+ ), -+ flag_set( -+ actions = [ -+ ACTION_NAMES.linkstamp_compile, -+ ACTION_NAMES.cpp_compile, -+ ACTION_NAMES.cpp_header_parsing, -+ ACTION_NAMES.cpp_module_compile, -+ ACTION_NAMES.cpp_module_codegen, -+ ACTION_NAMES.lto_backend, -+ ACTION_NAMES.clif_match, -+ ], -+ flag_groups = ([ -+ flag_group( -+ flags = ctx.attr.cxx_flags, -+ ), -+ ] if ctx.attr.cxx_flags else []), -+ ), - ], - ) - -@@ -1663,14 +1736,18 @@ cc_toolchain_config = rule( - "abi_libc_version": attr.string(), - "abi_version": attr.string(), - "archiver_flags": attr.string_list(default = []), -+ "c_flags": attr.string_list(), - "compiler": attr.string(), -+ "conly_flags": attr.string_list(), - "cpu": attr.string(mandatory = True), - "cxx_builtin_include_directories": attr.string_list(), -+ "cxx_flags": attr.string_list(), - "dbg_mode_debug_flag": attr.string(default = ""), - "default_compile_flags": attr.string_list(default = []), - "default_link_flags": attr.string_list(default = []), - "fastbuild_mode_debug_flag": attr.string(default = ""), - "host_system_name": attr.string(), -+ "link_flags": attr.string_list(), - "msvc_cl_path": attr.string(default = "vc_installation_error.bat"), - "msvc_env_include": attr.string(default = "msvc_not_found"), - "msvc_env_lib": attr.string(default = "msvc_not_found"), -@@ -1686,6 +1763,7 @@ cc_toolchain_config = rule( - "tool_bin_path": attr.string(default = "not_found"), - "tool_paths": attr.string_dict(), - "toolchain_identifier": attr.string(), -+ "win32_winnt_flag": attr.string(default = "/D_WIN32_WINNT=0x0601"), - }, - provides = [CcToolchainConfigInfo], - ) -diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl -index ad6cb86..9a39485 100644 ---- a/cc/private/toolchain/windows_cc_configure.bzl -+++ b/cc/private/toolchain/windows_cc_configure.bzl -@@ -756,7 +756,7 @@ Fix this by installing the English language pack for the Visual Studio installat - "%{msvc_dumpbin_path_" + target_arch + "}": build_tools["DUMPBIN"], - "%{msvc_parse_showincludes_" + target_arch + "}": repr(support_parse_showincludes), - "%{dbg_mode_debug_flag_" + target_arch + "}": "/DEBUG:FULL" if support_debug_fastlink else "/DEBUG", -- "%{fastbuild_mode_debug_flag_" + target_arch + "}": "/DEBUG:FASTLINK" if support_debug_fastlink else "/DEBUG", -+ "%{fastbuild_mode_debug_flag_" + target_arch + "}": "/DEBUG:FULL" if support_debug_fastlink else "/DEBUG", - } - return msvc_vars -