From 5a03bb751d0bb72ca97daf4b913366dc2e4295f3 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Mon, 20 Mar 2023 09:51:27 +0100 Subject: [PATCH] stub: update dependencies Update nightly toolchain and UEFI dependencies. The latest crane version comes with a bug where it fails to compile UEFI binaries. --- flake.lock | 12 ++++++------ flake.nix | 19 +++++++++++++++++++ rust/stub/Cargo.lock | 12 ++++++------ rust/stub/Cargo.toml | 4 ++-- rust/stub/rust-toolchain.toml | 2 +- rust/stub/src/main.rs | 1 - 6 files changed, 34 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index afd0807..433eec5 100644 --- a/flake.lock +++ b/flake.lock @@ -14,11 +14,11 @@ ] }, "locked": { - "lastModified": 1679272397, - "narHash": "sha256-4CeB4weE6bedPAjuszAftURWmtgR3aCds70YFk0bQ50=", + "lastModified": 1679285709, + "narHash": "sha256-oERwmwZPZ5BOqSv6cmcXfjIBPrFR6dp02oGE8mA+1n4=", "owner": "ipetkov", "repo": "crane", - "rev": "77435dad14835fa2ac86490978e10618dc952593", + "rev": "2552a2d1ccf33d43259a9e00f93dbacb9e6d6bed", "type": "github" }, "original": { @@ -243,11 +243,11 @@ ] }, "locked": { - "lastModified": 1679192997, - "narHash": "sha256-OZxPSyEDJTy4IATwFxUGDEEUYL6ZkgKn2FhlRlcLE08=", + "lastModified": 1679279218, + "narHash": "sha256-vWUbkLgNaUo0TYi5BaboPTaB6IjoZPm+0y0SqLS54Jc=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "32e4b1bf80cf99b7c72d2892198d40558828e6a1", + "rev": "c680a0a4144bb0931f6cebd601a3978bbafc4f64", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e9d6e19..0ef4e5e 100644 --- a/flake.nix +++ b/flake.nix @@ -92,6 +92,25 @@ inherit src; CARGO_BUILD_TARGET = target; inherit doCheck; + + # Workaround for https://github.com/ipetkov/crane/issues/262. + dummyrs = pkgs.writeText "dummy.rs" '' + #![allow(unused)] + + #![cfg_attr( + any(target_os = "none", target_os = "uefi"), + no_std, + no_main, + )] + + #[cfg_attr(any(target_os = "none", target_os = "uefi"), panic_handler)] + fn panic(_info: &::core::panic::PanicInfo<'_>) -> ! { + loop {} + } + + #[cfg_attr(any(target_os = "none", target_os = "uefi"), export_name = "efi_main")] + fn main() {} + ''; } // extraArgs; cargoArtifacts = craneLib.buildDepsOnly commonArgs; diff --git a/rust/stub/Cargo.lock b/rust/stub/Cargo.lock index 04072ab..892ac56 100644 --- a/rust/stub/Cargo.lock +++ b/rust/stub/Cargo.lock @@ -208,9 +208,9 @@ dependencies = [ [[package]] name = "uefi" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5607fef843201070ed442fa257c7a944fae963fac7d4620612123192eb4d844" +checksum = "ab39d5e7740f21ed4c46d6659f31038bbe3fe7a8be1f702d8a984348837c43b1" dependencies = [ "bitflags", "log", @@ -221,9 +221,9 @@ dependencies = [ [[package]] name = "uefi-macros" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8099684193f2d99f7f130951f4054a1591ff7da370e2b33d7a71f0434920499" +checksum = "e0caeb0e7b31b9f1f347e541106be10aa8c66c76fa722a3298a4cd21433fabd4" dependencies = [ "proc-macro2", "quote", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "uefi-services" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75daa44f951cc1d9dc68d98cabc06ddbccc221d7bd21222271be5d7ac526a9d" +checksum = "42d8ffbcc532083312224b4540737c1102ede6a81360fa9320a60deff329a3a1" dependencies = [ "cfg-if", "log", diff --git a/rust/stub/Cargo.toml b/rust/stub/Cargo.toml index 42f475c..90fd6db 100644 --- a/rust/stub/Cargo.toml +++ b/rust/stub/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" publish = false [dependencies] -uefi = { version = "0.19.1", default-features = false, features = [ "alloc", "global_allocator", "unstable" ] } -uefi-services = { version = "0.16.0", default-features = false, features = [ "panic_handler", "logger" ] } +uefi = { version = "0.20.0", default-features = false, features = [ "alloc", "global_allocator", "unstable" ] } +uefi-services = { version = "0.17.0", default-features = false, features = [ "panic_handler", "logger" ] } goblin = { version = "0.6.1", default-features = false, features = [ "pe64", "alloc" ]} # Even in debug builds, we don't enable the debug logs, because they generate a lot of spam from goblin. diff --git a/rust/stub/rust-toolchain.toml b/rust/stub/rust-toolchain.toml index f33bf1a..632dbc9 100644 --- a/rust/stub/rust-toolchain.toml +++ b/rust/stub/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2022-11-21" +channel = "nightly-2023-03-10" components = [ "rust-src" ] targets = [ "x86_64-unknown-uefi" ] diff --git a/rust/stub/src/main.rs b/rust/stub/src/main.rs index 61e7b94..2e88fc8 100644 --- a/rust/stub/src/main.rs +++ b/rust/stub/src/main.rs @@ -1,6 +1,5 @@ #![no_main] #![no_std] -#![feature(abi_efiapi)] #![feature(negative_impls)] #![deny(unsafe_op_in_unsafe_fn)]