Re: [PATCH 2/2] btf_encoder: Change functions check due to broken dwarf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 03, 2020 at 12:27:56PM -0800, Yonghong Song wrote:

SNIP

> > > > 
> > > 
> > > bpf_map iter definition:
> > > 
> > > DEFINE_BPF_ITER_FUNC(bpf_map, struct bpf_iter_meta *meta, struct bpf_map *map)
> > > 
> > > goes to:
> > > 
> > > #define DEFINE_BPF_ITER_FUNC(target, args...)                   \
> > >          extern int bpf_iter_ ## target(args);                   \
> > >          int __init bpf_iter_ ## target(args) { return 0; }
> > > 
> > > that creates __init bpf_iter_bpf_map function that will make
> > > it into BTF where it's expected when opening iterator, but the
> > > code will be freed because it's __init function
> > 
> > hm... should we just drop __init there?
> > 
> > Yonghong, is __init strictly necessary, or was just an optimization to
> > save a tiny bit of space?
> 
> It is an optimization to save some space. We only need function
> signature, not function body, for bpf_iter.
> 
> The macro definition is in include/linux/bpf.h.
> 
> #define DEFINE_BPF_ITER_FUNC(target, args...)                   \
>         extern int bpf_iter_ ## target(args);                   \
>         int __init bpf_iter_ ## target(args) { return 0; }
> 
> Maybe you could have a section, e.g., called
>   .init.bpf.preserve_type
> which you can scan through to preserve the types.

right, sounds good, will send v3 with that

thanks,
jirka




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux