From 9b913a884d0ab5248854935a12463b308c7e4ca9 Mon Sep 17 00:00:00 2001 From: Michal R Date: Wed, 5 Nov 2025 18:06:13 +0100 Subject: [PATCH] aya-ebpf: Remove `AyaBtfMapMarker` It was never necessary in the first place. There is no place in the kernel that enforces BTF map structs themselves to be anonymous. Only pointer types (that are members of BTF maps) have to be anonymous, but that's currently handled by LLVM[0]. BTF maps work just fine without it. [0] https://github.com/llvm/llvm-project/pull/163174 --- ebpf/aya-ebpf/src/btf_maps/mod.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/ebpf/aya-ebpf/src/btf_maps/mod.rs b/ebpf/aya-ebpf/src/btf_maps/mod.rs index a65a4a7e..086c49f1 100644 --- a/ebpf/aya-ebpf/src/btf_maps/mod.rs +++ b/ebpf/aya-ebpf/src/btf_maps/mod.rs @@ -1,22 +1,9 @@ -use core::marker::PhantomData; - pub mod array; pub mod sk_storage; pub use array::Array; pub use sk_storage::SkStorage; -/// A marker used to remove names of annotated types in LLVM debug info and -/// therefore also in BTF. -#[repr(transparent)] -pub(crate) struct AyaBtfMapMarker(PhantomData<()>); - -impl AyaBtfMapMarker { - pub(crate) const fn new() -> Self { - Self(PhantomData) - } -} - #[macro_export] macro_rules! btf_map_def { ($name:ident, $t:ident) => { @@ -30,9 +17,6 @@ macro_rules! btf_map_def { value: *const V, max_entries: *const [i32; M], map_flags: *const [i32; F], - - // Anonymize the struct. - _anon: $crate::btf_maps::AyaBtfMapMarker, } #[expect( @@ -47,7 +31,6 @@ macro_rules! btf_map_def { value: ::core::ptr::null(), max_entries: ::core::ptr::null(), map_flags: ::core::ptr::null(), - _anon: $crate::btf_maps::AyaBtfMapMarker::new(), } } }