Enable unwinding in userspace

Unwinding gives us more information, so we shouldn't disable it
globally. It is already disabled for BPF targets via the target configs
in rustc itself.

This complicates the clippy invocation somewhat, so put it in a shell
script for developer as well as CI use.
reviewable/pr1101/r8
Tamir Duberstein 2 months ago
parent 1de7e728b6
commit fd00b39f09

@ -46,7 +46,7 @@ jobs:
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo hack clippy --all-targets --feature-powerset --workspace -- --deny warnings
run: ./clippy.sh
- run: cargo xtask public-api
if: github.event_name == 'pull_request'
@ -165,10 +165,12 @@ jobs:
CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.bpf_target_arch }}
run: |
set -euxo pipefail
cargo hack build --package aya-ebpf --package aya-log-ebpf \
--feature-powerset \
cargo hack build \
--target ${{ matrix.target }} \
-Z build-std=core
-Z build-std=core \
--package aya-ebpf \
--package aya-log-ebpf \
--feature-powerset
- name: Test
env:
@ -176,7 +178,8 @@ jobs:
RUST_BACKTRACE: full
run: |
set -euxo pipefail
cargo hack test --doc \
cargo hack test \
--doc \
--package aya-ebpf \
--package aya-log-ebpf \
--feature-powerset

@ -96,12 +96,6 @@ tokio = { version = "1.24.0", default-features = false }
which = { version = "7.0.0", default-features = false }
xdpilone = { version = "1.0.5", default-features = false }
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
[profile.release.package.integration-ebpf]
debug = 2
codegen-units = 1

@ -0,0 +1,12 @@
#!/usr/bin/env sh
# `-C panic=abort` because "unwinding panics are not supported without std";
# integration-ebpf contains `#[no_std]` binaries.
#
# `-Zpanic_abort_tests` because "building tests with panic=abort is not supported without
# `-Zpanic_abort_tests`"; Cargo does this automatically when panic=abort is set via profile
# but we want to preserve unwinding at runtime - here we are just running clippy so we don't
# care about unwinding behavior.
#
# `+nightly` because "the option `Z` is only accepted on the nightly compiler".
exec cargo +nightly hack clippy "$@" --all-targets --feature-powerset --workspace -- --deny warnings -C panic=abort -Zpanic_abort_tests

@ -1,12 +0,0 @@
# We have this so that one doesn't need to manually pass
# --target=bpfel-unknown-none -Z build-std=core when running cargo
# check/build/doc etc.
#
# NB: this file gets loaded only if you run cargo from this directory, it's
# ignored if you run from the workspace root. See
# https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure
[build]
target = ["bpfeb-unknown-none", "bpfel-unknown-none"]
[unstable]
build-std = ["core"]

@ -54,7 +54,7 @@ pub fn build<F>(target: Option<&str>, f: F) -> Result<Vec<(String, PathBuf)>>
where
F: FnOnce(&mut Command) -> &mut Command,
{
// Always use rust-lld and -Zbuild-std in case we're cross-compiling.
// Always use rust-lld in case we're cross-compiling.
let mut cmd = Command::new("cargo");
cmd.args(["build", "--message-format=json"]);
if let Some(target) = target {

Loading…
Cancel
Save