Open CanCebeci opened 2 years ago
Hmm, haven't seen this one before. Only weird thing I can see is that I usually put the SEC() macro after the definition (just before the ;) for maps. If that doesn't help, what LLVM version are you seeing this with?
I had the issue with Clang 13. I don't have it with Clang 10.
Can Cebeci @.***> writes:
I had the issue with Clang 13. I don't have it with Clang 10.
Hmm, well in that case it wounds like a regression bug in Clang? I'd suggest you try reporting it as such :)
I am trying to use basic-02-prog-by-name as a skeleton to compile and load a bpf program that uses multiple maps.
The problem is, when I define multiple maps, each with
SEC("maps")
, they are compiled into and object file that has multiple sections named "maps", one per map.To illustrate the issue I am running into, consider the following: I modify xdp_prog_kern.c to include three instances of the map defined in the third basic tutorial:
and I modify the xdp_pass_func to access these maps:
When I run
make
, the generated object file has three "maps" sectionsWhen I try to load the program (xdp_pass) with
xdp_loader
, I get the following error:That is because libbpf loops over the sections in the object file and only loads the maps in the last section that is named "maps". Also note that trying to access
xdp_stats_map_3
instead ofxdp_stats_map_2
works fine, meaning the program is successfully loaded in that case.Why does
make
produce and object file with multiple "maps" sections? How can I work around this? Is there a way to get an object file with a unified "maps" section?Thanks :)