diff --git a/cc/private/compile/compile_build_variables.bzl b/cc/private/compile/compile_build_variables.bzl
index 4867fcad..03580727 100644
--- a/cc/private/compile/compile_build_variables.bzl
+++ b/cc/private/compile/compile_build_variables.bzl
@@ -618,7 +618,6 @@ def _compute_all_linkstamp_defines(
code_coverage_enabled):
"""Computes defines for linkstamp compilation."""
defines = [
- 'GPLATFORM="' + cc_toolchain.toolchain_id + '"',
"BUILD_COVERAGE_ENABLED=" + ("1" if code_coverage_enabled else "0"),
# G3_TARGET_NAME is a C string literal that normally contain the label of the target
# being linked. However, they are set differently when using shared native deps. In
diff --git a/cc/private/rules_impl/cc_toolchain.bzl b/cc/private/rules_impl/cc_toolchain.bzl
index 16c13ea9..9b988d9a 100644
--- a/cc/private/rules_impl/cc_toolchain.bzl
+++ b/cc/private/rules_impl/cc_toolchain.bzl
@@ -186,18 +186,6 @@ cc_toolchain = rule(
"licenses": attr.license() if hasattr(attr, "license") else attr.string_list(),
# buildifier: disable=attr-license
"output_licenses": attr.license() if hasattr(attr, "license") else attr.string_list(),
- "toolchain_identifier": attr.string(
- default = "",
- doc = """
-The identifier used to match this cc_toolchain with the corresponding
-crosstool_config.toolchain.
-
-
- Until issue #5380 is fixed
- this is the recommended way of associating cc_toolchain with
- CROSSTOOL.toolchain. It will be replaced by the toolchain_config
- attribute (#5380).
""",
- ),
"all_files": attr.label(
allow_files = True,
mandatory = True,
diff --git a/cc/private/rules_impl/cc_toolchain_info.bzl b/cc/private/rules_impl/cc_toolchain_info.bzl
index 639d2961..23b182fc 100644
--- a/cc/private/rules_impl/cc_toolchain_info.bzl
+++ b/cc/private/rules_impl/cc_toolchain_info.bzl
@@ -105,7 +105,6 @@ def _create_cc_toolchain_info(
libc = toolchain_config_info.target_libc,
cpu = toolchain_config_info.target_cpu,
target_gnu_system_name = toolchain_config_info.target_system_name,
- toolchain_id = toolchain_config_info.toolchain_id,
dynamic_runtime_solib_dir = dynamic_runtime_solib_dir,
objcopy_executable = objcopy_executable,
compiler_executable = compiler_executable,
@@ -192,7 +191,6 @@ CcToolchainInfo, _ = provider(
"libc": "libc version string.",
"cpu": "Target CPU of the C++ toolchain.",
"target_gnu_system_name": "The GNU System Name.",
- "toolchain_id": "",
"dynamic_runtime_solib_dir": "",
"objcopy_executable": "The path to the objcopy binary.",
"compiler_executable": "The path to the compiler binary.",
diff --git a/cc/private/toolchain/BUILD.empty.tpl b/cc/private/toolchain/BUILD.empty.tpl
index 3ae6387b..dd54ce30 100644
--- a/cc/private/toolchain/BUILD.empty.tpl
+++ b/cc/private/toolchain/BUILD.empty.tpl
@@ -51,7 +51,6 @@ cc_toolchain(
objcopy_files = ":empty",
strip_files = ":empty",
toolchain_config = ":local_config",
- toolchain_identifier = "local",
)
cc_toolchain_config(name = "local_config")
diff --git a/cc/private/toolchain/BUILD.static.bsd b/cc/private/toolchain/BUILD.static.bsd
index 30d57c2b..864372cc 100644
--- a/cc/private/toolchain/BUILD.static.bsd
+++ b/cc/private/toolchain/BUILD.static.bsd
@@ -73,7 +73,6 @@ cc_toolchain(
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":local_freebsd",
- toolchain_identifier = "local_freebsd",
)
cc_toolchain_config(
@@ -107,7 +106,6 @@ cc_toolchain(
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":local_openbsd",
- toolchain_identifier = "local_openbsd",
)
cc_toolchain_config(
@@ -141,7 +139,6 @@ cc_toolchain(
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":stub_armeabi-v7a",
- toolchain_identifier = "stub_armeabi-v7a",
)
cc_toolchain_config(
diff --git a/cc/private/toolchain/BUILD.tpl b/cc/private/toolchain/BUILD.tpl
index c8b0555e..3d1cae28 100644
--- a/cc/private/toolchain/BUILD.tpl
+++ b/cc/private/toolchain/BUILD.tpl
@@ -85,8 +85,7 @@ cc_toolchain_suite(
cc_toolchain(
name = "cc-compiler-%{name}",
- toolchain_identifier = "%{cc_toolchain_identifier}",
- toolchain_config = ":%{cc_toolchain_identifier}",
+ toolchain_config = ":cc-config-%{name}",
all_files = ":compiler_deps",
ar_files = ":compiler_deps",
as_files = ":compiler_deps",
@@ -101,10 +100,9 @@ cc_toolchain(
)
cc_toolchain_config(
- name = "%{cc_toolchain_identifier}",
+ name = ":cc-config-%{name}",
cpu = "%{target_cpu}",
compiler = "%{compiler}",
- toolchain_identifier = "%{cc_toolchain_identifier}",
host_system_name = "%{host_system_name}",
target_system_name = "%{target_system_name}",
target_libc = "%{target_libc}",
@@ -132,7 +130,6 @@ cc_toolchain_config(
# Android tooling requires a default toolchain for the armeabi-v7a cpu.
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
- toolchain_identifier = "stub_armeabi-v7a",
toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
diff --git a/cc/private/toolchain/BUILD.windows.tpl b/cc/private/toolchain/BUILD.windows.tpl
index afbc00d9..a5651fa8 100644
--- a/cc/private/toolchain/BUILD.windows.tpl
+++ b/cc/private/toolchain/BUILD.windows.tpl
@@ -99,7 +99,6 @@ cc_toolchain_suite(
cc_toolchain(
name = "cc-compiler-x64_windows_msys",
- toolchain_identifier = "msys_x64",
toolchain_config = ":msys_x64",
all_files = ":empty",
ar_files = ":empty",
@@ -148,7 +147,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_x86_windows_msys",
- toolchain_identifier = "msys_x64_x86",
toolchain_config = ":msys_x64_x86",
all_files = ":empty",
ar_files = ":empty",
@@ -199,7 +197,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_windows_mingw",
- toolchain_identifier = "msys_x64_mingw",
toolchain_config = ":msys_x64_mingw",
all_files = ":empty",
ar_files = ":empty",
@@ -248,7 +245,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_x86_windows_mingw",
- toolchain_identifier = "msys_x64_x86_mingw",
toolchain_config = ":msys_x64_x86_mingw",
all_files = ":empty",
ar_files = ":empty",
@@ -299,7 +295,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_windows",
- toolchain_identifier = "msvc_x64",
toolchain_config = ":msvc_x64",
all_files = ":empty",
ar_files = ":empty",
@@ -321,7 +316,6 @@ cc_toolchain_config(
target_libc = "msvcrt",
abi_version = "local",
abi_libc_version = "local",
- toolchain_identifier = "msvc_x64",
msvc_env_tmp = "%{msvc_env_tmp_x64}",
msvc_env_path = "%{msvc_env_path_x64}",
msvc_env_include = "%{msvc_env_include_x64}",
@@ -374,7 +368,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_x86_windows",
- toolchain_identifier = "msvc_x64_x86",
toolchain_config = ":msvc_x64_x86",
all_files = ":empty",
ar_files = ":empty",
@@ -396,7 +389,6 @@ cc_toolchain_config(
target_libc = "msvcrt",
abi_version = "local",
abi_libc_version = "local",
- toolchain_identifier = "msvc_x64_x86",
msvc_env_tmp = "%{msvc_env_tmp_x86}",
msvc_env_path = "%{msvc_env_path_x86}",
msvc_env_include = "%{msvc_env_include_x86}",
@@ -449,7 +441,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_arm_windows",
- toolchain_identifier = "msvc_x64_arm",
toolchain_config = ":msvc_x64_arm",
all_files = ":empty",
ar_files = ":empty",
@@ -471,7 +462,6 @@ cc_toolchain_config(
target_libc = "msvcrt",
abi_version = "local",
abi_libc_version = "local",
- toolchain_identifier = "msvc_x64_arm",
msvc_env_tmp = "%{msvc_env_tmp_arm}",
msvc_env_path = "%{msvc_env_path_arm}",
msvc_env_include = "%{msvc_env_include_arm}",
@@ -524,7 +514,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-arm64_windows",
- toolchain_identifier = "msvc_arm64",
toolchain_config = ":msvc_arm64",
all_files = ":empty",
ar_files = ":empty",
@@ -546,7 +535,6 @@ cc_toolchain_config(
target_libc = "msvcrt",
abi_version = "local",
abi_libc_version = "local",
- toolchain_identifier = "msvc_arm64",
msvc_env_tmp = "%{msvc_env_tmp_arm64}",
msvc_env_path = "%{msvc_env_path_arm64}",
msvc_env_include = "%{msvc_env_include_arm64}",
@@ -599,7 +587,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-x64_windows-clang-cl",
- toolchain_identifier = "clang_cl_x64",
toolchain_config = ":clang_cl_x64",
all_files = ":empty",
ar_files = ":empty",
@@ -621,7 +608,6 @@ cc_toolchain_config(
target_libc = "msvcrt",
abi_version = "local",
abi_libc_version = "local",
- toolchain_identifier = "clang_cl_x64",
msvc_env_tmp = "%{clang_cl_env_tmp_x64}",
msvc_env_path = "%{clang_cl_env_path_x64}",
msvc_env_include = "%{clang_cl_env_include_x64}",
@@ -672,7 +658,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-arm64_windows-clang-cl",
- toolchain_identifier = "clang_cl_arm64",
toolchain_config = ":clang_cl_arm64",
all_files = ":empty",
ar_files = ":empty",
@@ -694,7 +679,6 @@ cc_toolchain_config(
target_libc = "msvcrt",
abi_version = "local",
abi_libc_version = "local",
- toolchain_identifier = "clang_cl_arm64",
msvc_env_tmp = "%{clang_cl_env_tmp_arm64}",
msvc_env_path = "%{clang_cl_env_path_arm64}",
msvc_env_include = "%{clang_cl_env_include_arm64}",
@@ -744,7 +728,6 @@ toolchain(
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
- toolchain_identifier = "stub_armeabi-v7a",
toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
diff --git a/cc/private/toolchain/armeabi_cc_toolchain_config.bzl b/cc/private/toolchain/armeabi_cc_toolchain_config.bzl
index b35e43fe..071afd82 100644
--- a/cc/private/toolchain/armeabi_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/armeabi_cc_toolchain_config.bzl
@@ -22,7 +22,6 @@ load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/toolchains:cc_toolchain_config_info.bzl", "CcToolchainConfigInfo")
def _impl(ctx):
- toolchain_identifier = "stub_armeabi-v7a"
host_system_name = "armeabi-v7a"
target_system_name = "armeabi-v7a"
target_cpu = "armeabi-v7a"
@@ -63,7 +62,6 @@ def _impl(ctx):
action_configs = action_configs,
artifact_name_patterns = artifact_name_patterns,
cxx_builtin_include_directories = cxx_builtin_include_directories,
- toolchain_identifier = toolchain_identifier,
host_system_name = host_system_name,
target_system_name = target_system_name,
target_cpu = target_cpu,
diff --git a/cc/private/toolchain/bsd_cc_toolchain_config.bzl b/cc/private/toolchain/bsd_cc_toolchain_config.bzl
index 83b9313f..6b5724dd 100644
--- a/cc/private/toolchain/bsd_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/bsd_cc_toolchain_config.bzl
@@ -59,7 +59,6 @@ def _impl(ctx):
cpu = ctx.attr.cpu
is_bsd = cpu == "freebsd" or cpu == "openbsd"
compiler = "compiler"
- toolchain_identifier = "local_{}".format(cpu) if is_bsd else "stub_armeabi-v7a"
host_system_name = "local" if is_bsd else "armeabi-v7a"
target_system_name = "local" if is_bsd else "armeabi-v7a"
target_libc = "local" if is_bsd else "armeabi-v7a"
@@ -284,7 +283,6 @@ def _impl(ctx):
features = features,
action_configs = action_configs,
cxx_builtin_include_directories = cxx_builtin_include_directories,
- toolchain_identifier = toolchain_identifier,
host_system_name = host_system_name,
target_system_name = target_system_name,
target_cpu = cpu,
diff --git a/cc/private/toolchain/empty_cc_toolchain_config.bzl b/cc/private/toolchain/empty_cc_toolchain_config.bzl
index 5b2e49cd..c677c1b6 100644
--- a/cc/private/toolchain/empty_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/empty_cc_toolchain_config.bzl
@@ -22,7 +22,6 @@ def _impl(ctx):
return [
cc_common.create_cc_toolchain_config_info(
ctx = ctx,
- toolchain_identifier = "local_linux",
host_system_name = "local",
target_system_name = "local",
target_cpu = "local",
diff --git a/cc/private/toolchain/unix_cc_configure.bzl b/cc/private/toolchain/unix_cc_configure.bzl
index fe485d81..049b7b19 100644
--- a/cc/private/toolchain/unix_cc_configure.bzl
+++ b/cc/private/toolchain/unix_cc_configure.bzl
@@ -414,12 +414,6 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools):
# The parse_header tool needs to be a wrapper around the compiler as it has
# to touch the output file.
tool_paths["parse_headers"] = "cc_wrapper.sh"
- cc_toolchain_identifier = escape_string(get_env_var(
- repository_ctx,
- "CC_TOOLCHAIN_NAME",
- "local",
- False,
- ))
if "nm" in tool_paths and "c++filt" in tool_paths:
repository_ctx.template(
@@ -643,7 +637,6 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools):
] + (
[":validate_static_library"] if "validate_static_library" in tool_paths else []
)),
- "%{cc_toolchain_identifier}": cc_toolchain_identifier,
"%{compile_flags}": get_starlark_list(
[
"-fstack-protector",
diff --git a/cc/private/toolchain/unix_cc_toolchain_config.bzl b/cc/private/toolchain/unix_cc_toolchain_config.bzl
index f91fa3f1..4209714a 100644
--- a/cc/private/toolchain/unix_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/unix_cc_toolchain_config.bzl
@@ -1956,7 +1956,6 @@ def _impl(ctx):
action_configs = action_configs,
artifact_name_patterns = artifact_name_patterns,
cxx_builtin_include_directories = ctx.attr.cxx_builtin_include_directories,
- toolchain_identifier = ctx.attr.toolchain_identifier,
host_system_name = ctx.attr.host_system_name,
target_system_name = ctx.attr.target_system_name,
target_cpu = ctx.attr.cpu,
@@ -1996,7 +1995,6 @@ cc_toolchain_config = rule(
"target_libc": attr.string(mandatory = True),
"target_system_name": attr.string(mandatory = True),
"tool_paths": attr.string_dict(),
- "toolchain_identifier": attr.string(mandatory = True),
"unfiltered_compile_flags": attr.string_list(),
"_xcode_config": attr.label(default = configuration_field(
fragment = "apple",
diff --git a/cc/private/toolchain/windows_cc_toolchain_config.bzl b/cc/private/toolchain/windows_cc_toolchain_config.bzl
index 5fa087e5..956cdb2d 100644
--- a/cc/private/toolchain/windows_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/windows_cc_toolchain_config.bzl
@@ -1709,7 +1709,6 @@ def _impl(ctx):
action_configs = action_configs,
artifact_name_patterns = artifact_name_patterns,
cxx_builtin_include_directories = ctx.attr.cxx_builtin_include_directories,
- toolchain_identifier = ctx.attr.toolchain_identifier,
host_system_name = ctx.attr.host_system_name,
target_system_name = ctx.attr.target_system_name,
target_cpu = ctx.attr.cpu,
@@ -1753,7 +1752,6 @@ cc_toolchain_config = rule(
"target_system_name": attr.string(),
"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_config/cc_toolchain_config_info.bzl b/cc/private/toolchain_config/cc_toolchain_config_info.bzl
index 90a832ea..2229bb07 100644
--- a/cc/private/toolchain_config/cc_toolchain_config_info.bzl
+++ b/cc/private/toolchain_config/cc_toolchain_config_info.bzl
@@ -46,7 +46,6 @@ CcToolchainConfigInfo, _new_cc_toolchain_config_info = provider(
"target_libc",
"target_system_name",
"tool_paths",
- "toolchain_id",
],
init = _init,
)
@@ -55,7 +54,6 @@ CcToolchainConfigInfo, _new_cc_toolchain_config_info = provider(
def create_cc_toolchain_config_info(
*,
ctx,
- toolchain_identifier,
compiler,
features = [],
action_configs = [],
@@ -135,7 +133,6 @@ def create_cc_toolchain_config_info(
target_libc = target_libc or "",
target_system_name = target_system_name or "",
tool_paths = tool_paths,
- toolchain_id = toolchain_identifier,
)
# LINT.ThenChange(https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/toolchain_config/cc_toolchain_config_info.bzl:forked_exports)
diff --git a/cc/toolchains/impl/toolchain_config.bzl b/cc/toolchains/impl/toolchain_config.bzl
index 1f6efefe..523d2d1d 100644
--- a/cc/toolchains/impl/toolchain_config.bzl
+++ b/cc/toolchains/impl/toolchain_config.bzl
@@ -75,10 +75,6 @@ def _cc_toolchain_config_impl(ctx):
make_variables = legacy.make_variables,
features = legacy.features,
cxx_builtin_include_directories = legacy.cxx_builtin_include_directories,
- # toolchain_identifier is deprecated, but setting it to None results
- # in an error that it expected a string, and for safety's sake, I'd
- # prefer to provide something unique.
- toolchain_identifier = str(ctx.label),
# This can be accessed by users through
# @rules_cc//cc/private/toolchain:compiler to select() on the current
# compiler
diff --git a/examples/custom_toolchain/toolchain_config.bzl b/examples/custom_toolchain/toolchain_config.bzl
index 027f38ce..f779bca4 100644
--- a/examples/custom_toolchain/toolchain_config.bzl
+++ b/examples/custom_toolchain/toolchain_config.bzl
@@ -59,7 +59,6 @@ def _impl(ctx):
# C++ toolchain behavior.
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
- toolchain_identifier = "custom-toolchain-identifier",
host_system_name = "local",
target_system_name = "local",
target_cpu = "sample_cpu",