Remove legacy toolchain flags.

BEGIN_PUBLIC
Remove legacy toolchain flags.

This will allow us to enforce that users of the rule based toolchain are not using legacy toolchain resolution, and simplify toolchain creation.
END_PUBLIC

PiperOrigin-RevId: 640017209
Change-Id: I6ea4fad8ddf1a06ad17d706d82e54eb7f05aa6c6
diff --git a/cc/toolchains/impl/toolchain_config.bzl b/cc/toolchains/impl/toolchain_config.bzl
index 82e6695..656964d 100644
--- a/cc/toolchains/impl/toolchain_config.bzl
+++ b/cc/toolchains/impl/toolchain_config.bzl
@@ -85,12 +85,13 @@
             # 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),
-            target_system_name = ctx.attr.target_system_name,
-            target_cpu = ctx.attr.target_cpu,
-            target_libc = ctx.attr.target_libc,
-            compiler = ctx.attr.compiler,
-            abi_version = ctx.attr.abi_version,
-            abi_libc_version = ctx.attr.abi_libc_version,
+            # These fields are only relevant for legacy toolchain resolution.
+            target_system_name = "",
+            target_cpu = "",
+            target_libc = "",
+            compiler = "",
+            abi_version = "",
+            abi_libc_version = "",
             builtin_sysroot = sysroot,
         ),
         # This allows us to support all_files.
@@ -116,15 +117,6 @@
         # Attributes translated from legacy cc toolchains.
         "sysroot": attr.label(providers = [DirectoryInfo]),
         "cxx_builtin_include_directories": attr.label_list(providers = [DirectoryInfo]),
-
-        # TODO: remove these fields. I'm pretty sure they're unnecessary with
-        # --incompatible_enable_cc_toolchain_resolution.
-        "target_system_name": attr.string(),
-        "target_cpu": attr.string(),
-        "target_libc": attr.string(),
-        "compiler": attr.string(mandatory = True),
-        "abi_version": attr.string(),
-        "abi_libc_version": attr.string(),
     },
     provides = [ToolchainConfigInfo],
 )
diff --git a/tests/rule_based_toolchain/toolchain_config/BUILD b/tests/rule_based_toolchain/toolchain_config/BUILD
index 3fac686..bb01110 100644
--- a/tests/rule_based_toolchain/toolchain_config/BUILD
+++ b/tests/rule_based_toolchain/toolchain_config/BUILD
@@ -46,15 +46,11 @@
     name = "collects_files_toolchain_config",
     action_type_configs = [":compile_config"],
     args = [":c_compile_args"],
-    compiler = "gcc-4.1.1",
     cxx_builtin_include_directories = [
         "//tests/rule_based_toolchain/testdata:directory",
     ],
     skip_experimental_flag_validation_for_test = True,
     sysroot = "//tests/rule_based_toolchain/testdata:directory",
-    target_cpu = "k8",
-    target_libc = "glibc-2.2.2",
-    target_system_name = "local",
     toolchain_features = [":compile_feature"],
 )