On Tue, 2024-03-05 at 11:53 -0800, Andrii Nakryiko wrote: > On Mon, Mar 4, 2024 at 2:52 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > > > The next patch would add two new section names for struct_ops maps. > > To make working with multiple struct_ops sections more convenient: > > - remove fields like elf_state->st_ops_{shndx,link_shndx}; > > - mark section descriptions hosting struct_ops as > > elf_sec_desc->sec_type == SEC_ST_OPS; > > > > After these changes struct_ops sections could be processed uniformly > > by iterating bpf_object->efile.secs entries. > > > > Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > > --- > > tools/lib/bpf/libbpf.c | 62 ++++++++++++++++++++++-------------------- > > 1 file changed, 33 insertions(+), 29 deletions(-) > > > > Makes sense and a good generalization! Thank you. [...] > > @@ -1330,7 +1328,8 @@ static int init_struct_ops_maps(struct bpf_object *obj, const char *sec_name, > > map->def.key_size = sizeof(int); > > map->def.value_size = type->size; > > map->def.max_entries = 1; > > - map->def.map_flags = map_flags; > > + map->def.map_flags = strcmp(sec_name, STRUCT_OPS_LINK_SEC) == 0 > > + ? BPF_F_LINK : 0; > > Does it fit in under 100 characters? if yes, please keep on a single line Done [...]