Skip to content

Commit

Permalink
Fix linker error: undefined symbol core::panicking::panic
Browse files Browse the repository at this point in the history
Builds with `-Z build-std-features=panic_immediate_abort` to ensure the
`core::panicking` plumbing is stripped.

See: rust-lang/rust#55011

Adds `-Cpanic=abort` to RUSTFLAGS so that build profiles do not need to
specify `panic = "abort"` in Cargo.toml. This can potentially allow
simulator builds to customize panics. (Maybe printing to the console and
stopping the event loop, for instance. But this work is TBD.)

Fixes pd-rs/crankstart#66
  • Loading branch information
parasyte committed Sep 15, 2023
1 parent 155da63 commit 9f5539c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ impl Build {
args.push("thumbv7em-none-eabihf");

args.push("-Zbuild-std=core,alloc");
args.push("-Zbuild-std-features=panic_immediate_abort");
}

let envs = if self.device {
Expand All @@ -661,6 +662,7 @@ impl Build {
"-Ctarget-cpu=cortex-m7",
"-Clink-args=--emit-relocs",
"-Crelocation-model=pic",
"-Cpanic=abort",
]
.join(" "),
);
Expand Down

0 comments on commit 9f5539c

Please sign in to comment.