treewide: update rules_rust to v0.53.0
This updated our patches for rules_rust, removes a transition as it can
be replaced with the "platform" field in the rust_binary rule. This then
allows us to correctly reference it in all targets that depend on it.
Additionally the -target parameter is replaced inside the llvm-efi
toolchain with --target=.
Change-Id: Ie98753e505736c9ef28ff92fa1c5aa5b3612aec3
Reviewed-on: https://review.monogon.dev/c/monogon/+/3473
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/third_party/rules_rust/rust-uefi-platform.patch b/third_party/rules_rust/rust-uefi-platform.patch
new file mode 100644
index 0000000..e01cf29
--- /dev/null
+++ b/third_party/rules_rust/rust-uefi-platform.patch
@@ -0,0 +1,72 @@
+From b2d165d9b2c811293f92bf083289c97c9d87d13c Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@monogon.tech>
+Date: Wed, 25 Sep 2024 02:37:09 +0200
+Subject: [PATCH 1/4] Add support for UEFI targets and OS
+
+---
+ rust/platform/triple_mappings.bzl | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/rust/platform/triple_mappings.bzl b/rust/platform/triple_mappings.bzl
+index 139015da..efa9f167 100644
+--- a/rust/platform/triple_mappings.bzl
++++ b/rust/platform/triple_mappings.bzl
+@@ -47,6 +47,7 @@ SUPPORTED_T2_PLATFORM_TRIPLES = {
+ "aarch64-fuchsia": _support(std = True, host_tools = False),
+ "aarch64-linux-android": _support(std = True, host_tools = False),
+ "aarch64-pc-windows-msvc": _support(std = True, host_tools = True),
++ "aarch64-unknown-uefi": _support(std = True, host_tools = False),
+ "arm-unknown-linux-gnueabi": _support(std = True, host_tools = True),
+ "armv7-linux-androideabi": _support(std = True, host_tools = False),
+ "armv7-unknown-linux-gnueabi": _support(std = True, host_tools = True),
+@@ -65,6 +66,7 @@ SUPPORTED_T2_PLATFORM_TRIPLES = {
+ "x86_64-linux-android": _support(std = True, host_tools = False),
+ "x86_64-unknown-freebsd": _support(std = True, host_tools = True),
+ "x86_64-unknown-none": _support(std = True, host_tools = False),
++ "x86_64-unknown-uefi": _support(std = True, host_tools = False),
+ }
+
+ _T3_PLATFORM_TRIPLES = {
+@@ -142,6 +144,7 @@ _SYSTEM_TO_BUILTIN_SYS_SUFFIX = {
+ "nto": "qnx",
+ "openbsd": "openbsd",
+ "solaris": None,
++ "uefi": "uefi",
+ "unknown": None,
+ "wasi": None,
+ "windows": "windows",
+@@ -160,6 +163,7 @@ _SYSTEM_TO_BINARY_EXT = {
+ "nixos": "",
+ "none": "",
+ "nto": "",
++ "uefi": ".efi",
+ # This is currently a hack allowing us to have the proper
+ # generated extension for the wasm target, similarly to the
+ # windows target
+@@ -181,6 +185,7 @@ _SYSTEM_TO_STATICLIB_EXT = {
+ "nixos": ".a",
+ "none": ".a",
+ "nto": ".a",
++ "uefi": ".lib",
+ "unknown": "",
+ "wasi": "",
+ "windows": ".lib",
+@@ -199,6 +204,7 @@ _SYSTEM_TO_DYLIB_EXT = {
+ "nixos": ".so",
+ "none": ".so",
+ "nto": ".a",
++ "uefi": "", # UEFI doesn't have dynamic linking
+ "unknown": ".wasm",
+ "wasi": ".wasm",
+ "windows": ".dll",
+@@ -244,6 +250,7 @@ _SYSTEM_TO_STDLIB_LINKFLAGS = {
+ "nto": [],
+ "openbsd": ["-lpthread"],
+ "solaris": ["-lsocket", "-lposix4", "-lpthread", "-lresolv"],
++ "uefi": [],
+ "unknown": [],
+ "uwp": ["ws2_32.lib"],
+ "wasi": [],
+--
+2.44.1
+