From 9f5539c12b8b5bd35d312c7644ce5ba356a2e833 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Fri, 15 Sep 2023 10:38:34 -0700 Subject: [PATCH] Fix linker error: undefined symbol `core::panicking::panic` Builds with `-Z build-std-features=panic_immediate_abort` to ensure the `core::panicking` plumbing is stripped. See: https://github.com/rust-lang/rust/pull/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 https://github.com/pd-rs/crankstart/discussions/66 --- src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.rs b/src/main.rs index 4d5a84c..28c9817 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 { @@ -661,6 +662,7 @@ impl Build { "-Ctarget-cpu=cortex-m7", "-Clink-args=--emit-relocs", "-Crelocation-model=pic", + "-Cpanic=abort", ] .join(" "), );