Skip to content

svix/rust-executable-metadata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Usage

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-binary

It should also be legible to SBOM tools.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages