Skip to content

Commit eab5661

Browse files
committed
aya-build: enable BTF
1 parent 0237e36 commit eab5661

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,3 @@ unused_trait_names = "warn"
114114

115115
[workspace.lints.rust]
116116
unused-extern-crates = "warn"
117-
118-
[profile.release.package.integration-ebpf]
119-
codegen-units = 1
120-
debug = 2

aya-build/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ pub fn build_ebpf(packages: impl IntoIterator<Item = Package>, toolchain: Toolch
7575
]);
7676

7777
cmd.env("CARGO_CFG_BPF_TARGET_ARCH", &arch);
78+
cmd.env(
79+
"CARGO_ENCODED_RUSTFLAGS",
80+
["debuginfo=2", "link-arg=--btf"]
81+
.into_iter()
82+
.flat_map(|flag| ["-C", flag])
83+
.fold(String::new(), |mut acc, flag| {
84+
if !acc.is_empty() {
85+
acc.push('\x1f');
86+
}
87+
acc.push_str(flag);
88+
acc
89+
}),
90+
);
7891

7992
// Workaround to make sure that the correct toolchain is used.
8093
for key in ["RUSTC", "RUSTC_WORKSPACE_WRAPPER"] {

0 commit comments

Comments
 (0)