*: migrate to CC toolchains and Bazel 5.4.0

Change-Id: Iff3c0ddda4413dd0c5fa657a5b7813223e98611e
Reviewed-on: https://review.monogon.dev/c/monogon/+/1079
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/build/def.bzl b/metropolis/node/build/def.bzl
index d98fca0..2438deb 100644
--- a/metropolis/node/build/def.bzl
+++ b/metropolis/node/build/def.bzl
@@ -38,7 +38,7 @@
     """
     return {
         "@io_bazel_rules_go//go/config:static": True,
-        "//command_line_option:crosstool_top": "//build/toolchain/musl-host-gcc:musl_host_cc_suite",
+        "//command_line_option:platforms": "//build/platforms:linux_amd64_static",
     }
 
 build_static_transition = transition(
@@ -46,7 +46,7 @@
     inputs = [],
     outputs = [
         "@io_bazel_rules_go//go/config:static",
-        "//command_line_option:crosstool_top",
+        "//command_line_option:platforms",
     ],
 )
 
diff --git a/metropolis/node/build/efi.bzl b/metropolis/node/build/efi.bzl
index 5f6bfd6..8cc068f 100644
--- a/metropolis/node/build/efi.bzl
+++ b/metropolis/node/build/efi.bzl
@@ -49,7 +49,7 @@
 
     # Append the objcopy parameter separately, as it's not of File type, and
     # it does not constitute an input, since it's part of the toolchain.
-    objcopy = ctx.attr._toolchain[platform_common.ToolchainInfo].objcopy_executable
+    objcopy = ctx.toolchains["@bazel_tools//tools/cpp:toolchain_type"].cc.objcopy_executable
     args.append("-objcopy={}".format(objcopy))
 
     # Run mkpayload.
@@ -128,14 +128,12 @@
             executable = True,
             cfg = "exec",
         ),
-        "_toolchain": attr.label(
-            doc = "The toolchain used for objcopy.",
-            default = "//build/toolchain/llvm-efi:efi_cc_suite",
-            providers = [platform_common.ToolchainInfo],
-        ),
         # Allow for transitions to be attached to this rule.
         "_whitelist_function_transition": attr.label(
             default = "@bazel_tools//tools/whitelists/function_transition_whitelist",
         ),
     },
+    toolchains = [
+        "@bazel_tools//tools/cpp:toolchain_type"
+    ],
 )