[all-commits] [llvm/llvm-project] 379949: [BPF] Visit nested map array during BTF generation...
Mahé via All-commits
all-commits at lists.llvm.org
Mon Jul 28 13:45:38 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 379949d79f14b7854b6b2b8caebda835dcc3fe6d
https://github.com/llvm/llvm-project/commit/379949d79f14b7854b6b2b8caebda835dcc3fe6d
Author: Mahé <mahe5397 at hotmail.fr>
Date: 2025-07-28 (Mon, 28 Jul 2025)
Changed paths:
M llvm/lib/Target/BPF/BTFDebug.cpp
M llvm/test/CodeGen/BPF/BTF/map-def-2.ll
M llvm/test/CodeGen/BPF/BTF/map-def-3.ll
A llvm/test/CodeGen/BPF/BTF/map-def-nested-array.ll
Log Message:
-----------
[BPF] Visit nested map array during BTF generation (#150608)
Fixes missing inner map struct type definitions [^1]. We should visit
the type of nested array of maps like we do for global maps. This patch
adds a boolean to convey the information to visitTypeEntry and
visitDerivedType that the pointee is a map definition and should be
treated as such.
It ressembles and works with commit 0d21c956a5c1 ("[BPF] Handle nested
wrapper structs in BPF map definition traversal (#144097)") which
focused on directly nested wrapper structs.
Before that patch, this ARRAY_OF_MAPS definition would lead to the BTF
information include the 'missing_type' as "FWD 'missing_type'
fwd_kind=struct":
struct missing_type { uint64_t foo; };
struct {
__uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
[...]
__array(
values, struct {
[...]
__type(value, struct missing_type);
});
} map SEC(".maps");
Which lead to errors while trying to load the map:
libbpf: map 'outer_map.inner': can't determine value size for type [N]:
-22.
To solve this issue, users had to use the struct in a dummy variable or
in a dummy function for the BTF to be generated correctly [^2].
[^1]: https://lore.kernel.org/netdev/aH_cGvgC20iD8qs9@gmail.com/T/#u
[^2]:
https://github.com/cilium/ebpf/discussions/1658#discussioncomment-12491339
---------
Signed-off-by: Mahe Tardy <mahe.tardy at gmail.com>
Co-authored-by: Eduard Zingerman <eddyz87 at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list