Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build_std argument to allow specifying which std components to build #103

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ struct Args {
#[arg(long, default_value = "dot")]
format: OutputFormat,

/// Argument forwarded to cargo as `-Zbuild-std=?`
#[arg(long)]
build_std: Option<String>,

/// consider only the call graph that starts from this node
start: Option<String>,
}
Expand Down Expand Up @@ -161,14 +165,21 @@ fn run() -> anyhow::Result<i32> {
cargo.arg("--release");
}

let build_std = if is_no_std {
"-Zbuild-std=core,alloc,compiler_builtins"
if is_no_std && args.build_std.is_none() {
warn!(concat!(
"Building no_std target, did you mean to specify ",
"--build_std=core,alloc,compiler_builtins ?",
))
}

let build_std = if let Some(std_components) = args.build_std {
format!("-Zbuild-std={std_components}")
} else {
"-Zbuild-std"
String::from("-Zbuild-std")
};

cargo.args(&[
build_std,
&build_std,
"--color=always",
"--",
// .ll file
Expand Down