From 982a129f3ebaea69187544c1b00c4a217f94db79 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Tue, 7 Jul 2026 10:24:53 +0200 Subject: [PATCH 1/3] Makefile: refactor bare-metal packages into a variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Collect the packages that require --target x86_64-unknown-none into a BARE_METAL_MEMBERS variable and loop over them instead of repeating each --exclude and --package invocation. This makes it easier to add or remove bare-metal crates in the future. Suggested-by: Carlos López Signed-off-by: Luigi Leonardi --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6c5ea3e8fe..e8b712e70c 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,10 @@ CARGO ?= cargo CLIPPY_OPTIONS ?= --all-features CLIPPY_ARGS ?= -D warnings +# Packages that require --target x86_64-unknown-none +BARE_METAL_MEMBERS := svsm stage1 +BARE_METAL_EXCLUDES := $(addprefix --exclude ,$(BARE_METAL_MEMBERS)) + ifdef CARGO_HACK CARGO = cargo hack CLIPPY_OPTIONS = --each-feature @@ -157,11 +161,11 @@ endif touch ${FS_BIN} clippy: - ${CARGO} clippy ${CLIPPY_OPTIONS} --workspace --exclude svsm --exclude stage1 --exclude svsm-fuzz -- ${CLIPPY_ARGS} + ${CARGO} clippy ${CLIPPY_OPTIONS} --workspace $(BARE_METAL_EXCLUDES) --exclude svsm-fuzz -- ${CLIPPY_ARGS} RUSTFLAGS="--cfg fuzzing" ${CARGO} clippy ${CLIPPY_OPTIONS} --package svsm-fuzz -- ${CLIPPY_ARGS} - ${CARGO} clippy ${CLIPPY_OPTIONS} --package svsm --target x86_64-unknown-none -- ${CLIPPY_ARGS} - ${CARGO} clippy ${CLIPPY_OPTIONS} --package bldr --target x86_64-unknown-none -- ${CLIPPY_ARGS} - ${CARGO} clippy ${CLIPPY_OPTIONS} --package stage1 --target x86_64-unknown-none -- ${CLIPPY_ARGS} + for pkg in $(BARE_METAL_MEMBERS); do \ + ${CARGO} clippy ${CLIPPY_OPTIONS} --package $$pkg --target x86_64-unknown-none -- ${CLIPPY_ARGS} || exit 1; \ + done ${CARGO} clippy ${CLIPPY_OPTIONS} --workspace --tests --exclude svsm -- ${CLIPPY_ARGS} ${CARGO} clippy ${CLIPPY_OPTIONS} --package svsm --tests -- ${CLIPPY_ARGS} From 69288e7be41ae14abdefd762aaa88ebf90363073 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Tue, 7 Jul 2026 10:24:53 +0200 Subject: [PATCH 2/3] Makefile: exclude bldr from workspace clippy The bldr crate only targets x86_64-unknown-none. Running clippy with --workspace lints it against the host target, which can produce incorrect errors. Exclude it from the workspace invocation since it is already linted separately with the correct target. Reported-by: Arun Menon Signed-off-by: Luigi Leonardi --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8b712e70c..b7de2a8e01 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ CLIPPY_OPTIONS ?= --all-features CLIPPY_ARGS ?= -D warnings # Packages that require --target x86_64-unknown-none -BARE_METAL_MEMBERS := svsm stage1 +BARE_METAL_MEMBERS := svsm bldr stage1 BARE_METAL_EXCLUDES := $(addprefix --exclude ,$(BARE_METAL_MEMBERS)) ifdef CARGO_HACK From bb3f90f0e043876d0a4c0c97689c2897a041a29d Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Tue, 7 Jul 2026 10:26:26 +0200 Subject: [PATCH 3/3] bldr: always pass --build-id=none linker flag The build script only passed --build-id=none when the target was x86_64-unknown-none. Since bldr is only ever built for this target, the conditional is unnecessary. Remove it. Signed-off-by: Luigi Leonardi --- boot/bldr/build.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/boot/bldr/build.rs b/boot/bldr/build.rs index 7ca6a5793a..a212e4d9c4 100644 --- a/boot/bldr/build.rs +++ b/boot/bldr/build.rs @@ -5,12 +5,7 @@ // Author: Joerg Roedel fn main() { - let target = std::env::var("TARGET").unwrap(); - - if target == "x86_64-unknown-none" { - println!("cargo:rustc-link-arg=--build-id=none"); - } - + println!("cargo:rustc-link-arg=--build-id=none"); println!("cargo:rustc-link-arg=-nostdlib"); println!("cargo:rustc-link-arg=-Tboot/bldr/src/bldr.lds"); println!("cargo:rustc-link-arg=-no-pie");