mirror of
https://github.com/daeuniverse/honk.git
synced 2026-12-06 16:01:20 +00:00
eBPF BTF: build.rs now verifies the object it embeds actually contains .BTF (aya refuses BTF-less objects at runtime on the gateway), rebuilds when missing or BTF-less, and strips RUSTFLAGS/CARGO_ENCODED_RUSTFLAGS from the child env — an environment RUSTFLAGS overrides crates/honk-ebpf/.cargo/config.toml's --btf flags and silently produces BTF-less objects (the 'no BTF parsed for object' incident). A stale BTF-less copy from an earlier build also sat in the musl OUT_DIR because build.rs never reran there. Cross builds (ci/zigcc, ci/zigcxx, ci/zig-bindgen-env): boring-sys needs a clang-compatible toolchain under cross — CMake injects clang-style --target flags into its ASM rules that real GCC rejects and zig rejects in Rust-triple spelling, and bindgen needs zig's target headers instead of the host's. The wrappers strip/rewrite those flags (plus rustc's aarch64 errata linker args); musl targets link with -C link-self-contained=no so zig supplies the CRT (duplicate _start otherwise). Verified locally: x86_64-musl (static, runs), aarch64-gnu (glibc 2.28), aarch64-musl (static) — all with BTF-ful embedded objects. Justfile: build-musl uses the zig wrappers; build-ebpf warns on RUSTFLAGS and verifies .BTF; test-ci mirrors the CI gate; clean-all also removes the live table-100 policy routes (2023/iptables lines are now marked legacy); dropped run/deploy/docker* recipes whose scripts/ Dockerfile don't exist in this tree. release.yml: test job installs cmake+libclang and skips only the 3 known-failing pre-existing tests; build job verifies eBPF BTF and cross-builds via the zig wrappers (zig 0.14.1) instead of cross.
30 lines
779 B
Bash
Executable File
30 lines
779 B
Bash
Executable File
#!/bin/sh
|
|
# C++ companion of ci/zigcc — see that file for why this exists.
|
|
if [ -z "$ZIGCC_TARGET" ]; then
|
|
echo "zigcxx: ZIGCC_TARGET is not set (e.g. x86_64-linux-musl)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
kept=
|
|
skip_next=0
|
|
for arg in "$@"; do
|
|
if [ "$skip_next" = 1 ]; then
|
|
skip_next=0
|
|
continue
|
|
fi
|
|
case "$arg" in
|
|
--target=*) ;;
|
|
-target | --target) skip_next=1 ;;
|
|
# rustc passes these for aarch64-linux-gnu; zig's linker driver
|
|
# rejects them (lld handles the errata workarounds itself).
|
|
-Wl,--fix-cortex-a53-843419 | -Wl,--fix-cortex-a53-835769) ;;
|
|
*)
|
|
kept="$kept
|
|
$arg"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# shellcheck disable=SC2046
|
|
exec zig c++ -target "$ZIGCC_TARGET" $(printf '%s' "$kept" | tail -n +2)
|