From d264cf5485b0ed68603a30f3caf2109263d80cb8 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 26 Nov 2024 12:44:04 -0500 Subject: [PATCH] Enable unwinding in userspace --- Cargo.toml | 6 ------ test.sh | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8ee240..a2b2c84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,12 +21,6 @@ log = { version = "0.4.22", default-features = false } tokio = { version = "1.40.0", default-features = false } which = { version = "6.0.0", default-features = false } -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" - [profile.release.package.{{project-name}}-ebpf] debug = 2 codegen-units = 1 diff --git a/test.sh b/test.sh index 570e13a..a307c53 100755 --- a/test.sh +++ b/test.sh @@ -77,12 +77,23 @@ case $OS in cargo +nightly fmt --all -- --check cargo build --package "${CRATE_NAME}" cargo build --package "${CRATE_NAME}" --release - # We cannot run clippy over the whole workspace at once due to feature unification. Since both - # ${CRATE_NAME} and ${CRATE_NAME}-ebpf depend on ${CRATE_NAME}-common and ${CRATE_NAME} activates - # ${CRATE_NAME}-common's aya dependency, we end up trying to compile the panic handler twice: once - # from the bpf program, and again from std via aya. + # Running clippy over ${CRATE_NAME}-ebpf *from the workspace root* produces: + # + # error: unwinding panics are not supported without std + # + # Running clippy over ${CRATE_NAME}-ebpf with `--all-targets` produces: + # + # error[E0463]: can't find crate for `test` + # + # Both of these make sense; the former is using the host toolchain's unwinding std on a no_std + # binary, and the latter is trying to link libtest which isn't present in a core-only std. + # + # These concerns aside, we also cannot run clippy over the whole workspace at once due to feature + # unification. Since both ${CRATE_NAME} and ${CRATE_NAME}-ebpf depend on ${CRATE_NAME}-common and + # ${CRATE_NAME} activates ${CRATE_NAME}-common's aya dependency, we end up trying to compile the + # panic handler twice: once from the bpf program, and again from std via aya. cargo clippy --exclude "${CRATE_NAME}-ebpf" --all-targets --workspace -- --deny warnings - cargo clippy --package "${CRATE_NAME}-ebpf" --all-targets -- --deny warnings + cargo -Z unstable-options -C "${CRATE_NAME}-ebpf" hack clippy --feature-powerset -- --deny warnings expect <