Skip to content

rust/Makefile*: remove -Z build options for NO_STD builds#124

Draft
antklein wants to merge 1 commit intoOpenDevicePartnership:mainfrom
antklein:makefile_no_std_cleanup
Draft

rust/Makefile*: remove -Z build options for NO_STD builds#124
antklein wants to merge 1 commit intoOpenDevicePartnership:mainfrom
antklein:makefile_no_std_cleanup

Conversation

@antklein
Copy link
Copy Markdown

@antklein antklein commented Apr 8, 2026

This PR removes the explicit nightly cargo -Z flags from the NO_STD_FLAGS used in patina Makefile.toml files.

Testing on the patina-dxe-core-qemu shows that these options are no longer necessary for compiling patina dxe core for x86_64-unknown-uefi and aarch64-unknown-uefi targets.

Further testing in progress.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Patina cargo-make Makefile templates under .sync/rust/Makefiles to stop passing nightly-only cargo -Z build-std* flags as part of the default “no-std”/UEFI build flag sets, relying instead on the toolchain-provided UEFI target artifacts.

Changes:

  • Removed -Zbuild-std=..., -Zbuild-std-features=..., and -Zunstable-options from NO_STD_FLAGS/BUILD_FLAGS for UEFI/no_std builds.
  • Simplified DXE readiness tool capture build flags to no longer prepend the removed NO_STD_FLAGS.
  • Kept --profile ${RUSTC_PROFILE} and --timings in the relevant flag variables.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.sync/rust/Makefiles/Makefile-patina.toml Simplifies NO_STD_FLAGS by removing nightly -Z build-std* options.
.sync/rust/Makefiles/Makefile-patina-readiness-tool.toml Removes NO_STD_FLAGS usage from capture build flags.
.sync/rust/Makefiles/Makefile-patina-paging.toml Simplifies BUILD_FLAGS by removing nightly -Z build-std* options.
.sync/rust/Makefiles/Makefile-patina-mtrr.toml Simplifies BUILD_FLAGS by removing nightly -Z build-std* options.
.sync/rust/Makefiles/Makefile-patina-dxe-core-qemu.toml Simplifies NO_STD_FLAGS by removing nightly -Z build-std* options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


[env]
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem -Zunstable-options --timings"
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --timings"
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Makefile defines BUILD_FLAGS, but later tasks (e.g. check_no_std / check_std) still reference NO_STD_FLAGS and STD_FLAGS, which are not defined anywhere in this file. This can make those tasks run without the intended flags (or fail, depending on how @@split handles an unset var). Consider either defining NO_STD_FLAGS/STD_FLAGS in [env] (as done in other Patina Makefiles) or updating the tasks to consistently use BUILD_FLAGS plus any required std/no_std feature flags.

Suggested change
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --timings"
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --timings"
NO_STD_FLAGS = "${BUILD_FLAGS}"
STD_FLAGS = "${BUILD_FLAGS}"

Copilot uses AI. Check for mistakes.

[env]
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem -Zunstable-options --timings"
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --timings"
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Makefile updates BUILD_FLAGS, but later tasks still reference NO_STD_FLAGS and STD_FLAGS which are not defined in this file. That means check_no_std / check_std may not apply the intended flags (or may fail if unset vars aren’t tolerated). Consider defining NO_STD_FLAGS/STD_FLAGS in [env] or refactoring the check tasks to use BUILD_FLAGS consistently.

Suggested change
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --timings"
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --timings"
STD_FLAGS = "${BUILD_FLAGS} --features std"
NO_STD_FLAGS = "${BUILD_FLAGS} --no-default-features"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants