Use `target_arch = "bpf"` for `panic_handler`-cfg

The `panic_handler` defined in the eBPF crate is only required if we are
compiling for the bpf target. When compiling for the host-system, be it to
run tests or by compiling the entire workspace with `cargo check --workspace`
we don't want to define the `panic_handler`, otherwise it will clash with
the one defined by the standard library.

Related: https://github.com/aya-rs/book/issues/214
pull/140/head
Thomas Eizinger 4 weeks ago
parent bc8848eb62
commit 8e746d08cd
No known key found for this signature in database
GPG Key ID: 05633CD77196CAF3

@ -319,7 +319,7 @@ fn try_{{crate_name}}(ctx: PerfEventContext) -> Result<u32, u32> {
}
{%- endcase %}
#[cfg(not(test))]
#[cfg(target_arch = "bpf")]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}

Loading…
Cancel
Save