From eb7b9d92415680585a6aa8a2014fc3912d6fb749 Mon Sep 17 00:00:00 2001 From: Niklas Sombert Date: Sat, 9 Oct 2021 22:02:51 +0200 Subject: [PATCH 1/2] Use build-std-features instead of rlibc --- .cargo/config | 1 + BUILDING.md | 2 +- template/.cargo/config | 1 + template/Cargo.toml | 2 -- template/src/main.rs | 2 -- uefi-test-runner/Cargo.toml | 4 ---- uefi-test-runner/src/main.rs | 3 --- 7 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.cargo/config b/.cargo/config index 4be91559e..422bf9d2a 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,2 +1,3 @@ [unstable] build-std = ["core", "compiler_builtins", "alloc"] +build-std-features = ["compiler-builtins-mem"] diff --git a/BUILDING.md b/BUILDING.md index 6f659b4bd..a07924f48 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -24,7 +24,7 @@ application. Copy it to a new directory to get started. - Build using a `nightly` version of the compiler and activate the [`build-std`](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) - Cargo feature: `cargo +nightly build -Z build-std --target x86_64-unknown-uefi`. + Cargo features: `cargo +nightly build -Z build-std -Z build-std-features=compiler-builtins-mem --target x86_64-unknown-uefi`. - The `target` directory will contain a `x86_64-unknown-uefi` subdirectory, where you will find the `uefi_app.efi` file - a normal UEFI executable. diff --git a/template/.cargo/config b/template/.cargo/config index 4be91559e..422bf9d2a 100644 --- a/template/.cargo/config +++ b/template/.cargo/config @@ -1,2 +1,3 @@ [unstable] build-std = ["core", "compiler_builtins", "alloc"] +build-std-features = ["compiler-builtins-mem"] diff --git a/template/Cargo.toml b/template/Cargo.toml index 774a18497..8f14c1083 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -4,8 +4,6 @@ version = "0.1.0" edition = "2018" [dependencies] -rlibc = "1.0.0" - # In a real application, change these to point to the latest release # on crates.io. uefi = { path = "..", features = ["exts"] } diff --git a/template/src/main.rs b/template/src/main.rs index 721fc0342..3fc3475e3 100644 --- a/template/src/main.rs +++ b/template/src/main.rs @@ -2,8 +2,6 @@ #![no_std] #![feature(abi_efiapi)] -extern crate rlibc; - use uefi::prelude::*; use uefi::ResultExt; diff --git a/uefi-test-runner/Cargo.toml b/uefi-test-runner/Cargo.toml index de369fbb9..67b5e2913 100644 --- a/uefi-test-runner/Cargo.toml +++ b/uefi-test-runner/Cargo.toml @@ -11,10 +11,6 @@ uefi-services = { path = "../uefi-services" } log = { version = "0.4.11", default-features = false } -# When building using Cargo's `build-std` feature, the `mem` feature of `compiler-builtins` -# does not automatically get enabled. Therefore, we have to manually add support for -# the memory functions. -rlibc = "1.0.0" qemu-exit = "2.0.0" [features] diff --git a/uefi-test-runner/src/main.rs b/uefi-test-runner/src/main.rs index 098e6ddea..50d57a8a5 100644 --- a/uefi-test-runner/src/main.rs +++ b/uefi-test-runner/src/main.rs @@ -8,9 +8,6 @@ extern crate log; #[macro_use] extern crate alloc; -// Keep this line to ensure the `mem*` functions are linked in. -extern crate rlibc; - use alloc::string::String; use core::mem; use uefi::prelude::*; From 097ed22ea768ab27bf7e5777f1f6ffa4ad846fc4 Mon Sep 17 00:00:00 2001 From: Niklas Sombert Date: Mon, 18 Oct 2021 12:35:26 +0200 Subject: [PATCH 2/2] Remove Cargo features from BUILDING.md --- BUILDING.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index a07924f48..17a23bcc6 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -22,9 +22,8 @@ application. Copy it to a new directory to get started. ## Building and running -- Build using a `nightly` version of the compiler and activate the - [`build-std`](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) - Cargo features: `cargo +nightly build -Z build-std -Z build-std-features=compiler-builtins-mem --target x86_64-unknown-uefi`. +- Build using a `nightly` version of the compiler: + `cargo +nightly build --target x86_64-unknown-uefi`. - The `target` directory will contain a `x86_64-unknown-uefi` subdirectory, where you will find the `uefi_app.efi` file - a normal UEFI executable.