mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
feat(eBPF): embed BTF information in eBPF kernel (#8842)
It turns out that the Rust compiler doesn't always say that it is adding debug information to a binary even when it does! The build output only displays `[optimized]` when in fact it does actually emit debug information. Adding an additional linker flag configures `bpf-linker` to include the necessary BTF information in our kernel. This makes debugging verifier errors much easier as the program output contains source code annotiations. It also should make it easier to debug issues using `xdpdump` which relies on BTF information. Resolves: #8503
This commit is contained in:
@@ -234,3 +234,6 @@ split-debuginfo = "packed"
|
||||
[profile.release.package.firezone-gui-client]
|
||||
debug = "full"
|
||||
split-debuginfo = "packed"
|
||||
|
||||
[profile.release.package.ebpf-turn-router]
|
||||
debug = 2
|
||||
|
||||
@@ -14,4 +14,11 @@ use which::which;
|
||||
fn main() {
|
||||
let bpf_linker = which("bpf-linker").expect("bpf-linker not found in $PATH");
|
||||
println!("cargo:rerun-if-changed={}", bpf_linker.to_str().unwrap());
|
||||
|
||||
if std::env::var("CARGO_BUILD_TARGET")
|
||||
.ok()
|
||||
.is_some_and(|t| t == "bpfel-unknown-none" || t == "bpfeb-unknown-unknown")
|
||||
{
|
||||
println!("cargo:rustc-link-arg=--btf");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user