From 04584fe9c5fa2b8b5946275f12548bef295ec55c Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Tue, 29 Mar 2022 14:53:04 +0200 Subject: [PATCH] ebpf: Make the dev target identical to release eBPF programs cannot be debugged and those ones built with the default dev profile are often annoying the verifier. Therefore it doesn't make sense to compile not optimized eBPF objects. However, we still want to let people to use the dev profile, especially in the future when we want to get rid of xtask by using cargo binary dependencies[0]. The trick is to have no real difference between dev and release profile in eBPF. This change doesn't affect the userspace part which still is going to contain debug symbols when built with dev profile. [0] https://rust-lang.github.io/rfcs/3028-cargo-binary-dependencies.html Signed-off-by: Michal Rostecki --- {{project-name}}-ebpf/Cargo.toml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/{{project-name}}-ebpf/Cargo.toml b/{{project-name}}-ebpf/Cargo.toml index 4d07f31..b83f4cc 100644 --- a/{{project-name}}-ebpf/Cargo.toml +++ b/{{project-name}}-ebpf/Cargo.toml @@ -12,13 +12,20 @@ name = "{{ project-name }}" path = "src/main.rs" [profile.dev] -panic = "abort" -debug = 1 -opt-level = 2 +opt-level = 3 +debug = false +debug-assertions = false overflow-checks = false +lto = true +panic = "abort" +incremental = false +codegen-units = 1 +rpath = false [profile.release] +lto = true panic = "abort" +codegen-units = 1 [workspace] members = []