diff options
author | Mahé <mahe5397@hotmail.fr> | 2025-07-28 22:45:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-28 13:45:15 -0700 |
commit | 379949d79f14b7854b6b2b8caebda835dcc3fe6d (patch) | |
tree | aa21053b95841361a911cb8b2bdff97b2da40ecd /clang/unittests/Serialization/ModuleCacheTest.cpp | |
parent | c46336b396e4482c51ed4bfdfa55c22ab35a6ad1 (diff) | |
download | llvm-379949d79f14b7854b6b2b8caebda835dcc3fe6d.zip llvm-379949d79f14b7854b6b2b8caebda835dcc3fe6d.tar.gz llvm-379949d79f14b7854b6b2b8caebda835dcc3fe6d.tar.bz2 |
[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@gmail.com>
Co-authored-by: Eduard Zingerman <eddyz87@gmail.com>
Diffstat (limited to 'clang/unittests/Serialization/ModuleCacheTest.cpp')
0 files changed, 0 insertions, 0 deletions