This is a small Rust library for injecting the .note.package ELF section into programs built with Rust. The primary target is making such programs legible to SBOM-generating software like syft. This library only has any effect on Linux at this time.
The .note.package section is a Fedora Project-originated feature for annotating software.
Add the project to the [build-dependencies] section of Cargo.toml:
[build-dependencies]
rust-executable-metadata = "*"Then add a build.rs to your project with the following contents:
fn main() {
rust_executable_metadata::PackageMetadataBuilder::new_from_cargo("your-cpe-vendor-name")
.expect("Should be able to parse cargo environment variables")
.maintainer("you@example.com")
.copyright("2026 YOUR CO")
.build()
.unwrap()
.write_linker_script_and_inject_argument();
}If you build this on a Linux system, you can read the associated metadata with
readelf -p .note.package target/release/your-binaryIt should also be legible to SBOM tools.