From f1cd14d6b7cfb04a3fed7cc32b6afc1d8d0862f9 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Thu, 8 Aug 2024 21:48:03 -0400 Subject: [PATCH] Set ImageBase to 0 and Subsystem to EFI Boot Services in config.toml (#356) Currently sets the ImageBase in the PE/COFF header to `0` as expected for UEFI images. The cargo config file will be synced to Rust enabled repos to apply the linker flags regardless of whether the Rust code is compiled directly or through the firmware build system. --------- Signed-off-by: Michael Kubacki --- .sync/Files.yml | 12 ++++++++++++ .sync/rust_config/config.toml | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .sync/rust_config/config.toml diff --git a/.sync/Files.yml b/.sync/Files.yml index 33e34577..d4bf7791 100644 --- a/.sync/Files.yml +++ b/.sync/Files.yml @@ -697,3 +697,15 @@ group: microsoft/mu_basecore microsoft/mu_plus microsoft/mu_tiano_platforms + +# Rust - Config (for UEFI builds) + - files: + - source: .sync/rust_config/config.toml + dest: .cargo/config.toml + repos: | + microsoft/mu_basecore + microsoft/mu_plus + microsoft/mu_rust_helpers + microsoft/mu_rust_hid + microsoft/mu_rust_pi + microsoft/mu_tiano_platforms diff --git a/.sync/rust_config/config.toml b/.sync/rust_config/config.toml new file mode 100644 index 00000000..48bd897d --- /dev/null +++ b/.sync/rust_config/config.toml @@ -0,0 +1,17 @@ +[target.x86_64-unknown-uefi] +rustflags = [ + "-C", "link-arg=/base:0x0", + "-C", "link-arg=/subsystem:efi_boot_service_driver", +] + +[target.i686-unknown-uefi] +rustflags = [ + "-C", "link-arg=/base:0x0", + "-C", "link-arg=/subsystem:efi_boot_service_driver", +] + +[target.aarch64-unknown-uefi] +rustflags = [ + "-C", "link-arg=/base:0x0", + "-C", "link-arg=/subsystem:efi_boot_service_driver", +]