Re: [PATCH bpf-next 1/2] btf: resolve enum fwds in btf_dedup

2019-03-14 Thread Alexei Starovoitov
On Mon, Mar 11, 2019 at 10:39:37AM -0700, Andrii Nakryiko wrote: > > There is a GCC extension that allows to forward-declare enums: > https://gcc.gnu.org/onlinedocs/gcc/Incomplete-Enums.html#Incomplete-Enums > > Kernel actually has examples of using this (see patch description > regrading irqchip

Re: [PATCH bpf-next 1/2] btf: resolve enum fwds in btf_dedup

2019-03-11 Thread Andrii Nakryiko
On Mon, Mar 11, 2019 at 10:27 AM Edward Cree wrote: > > On 11/03/19 16:34, Andrii Nakryiko wrote: > > The only thing we should consider is that enums can have different > > sizes. And enum size is part of enum's forward declaration. So unlike > > struct/union fwd, enum's fwd has extra info. I don'

Re: [PATCH bpf-next 1/2] btf: resolve enum fwds in btf_dedup

2019-03-11 Thread Edward Cree
On 11/03/19 16:34, Andrii Nakryiko wrote: > The only thing we should consider is that enums can have different > sizes. And enum size is part of enum's forward declaration. So unlike > struct/union fwd, enum's fwd has extra info. I don't think it's > possible to specify in C (enum is always 4 bytes

Re: [PATCH bpf-next 1/2] btf: resolve enum fwds in btf_dedup

2019-03-11 Thread Andrii Nakryiko
On Mon, Mar 11, 2019 at 12:02 AM Yonghong Song wrote: > > > > On 3/10/19 5:44 PM, Andrii Nakryiko wrote: > > GCC and clang support enum forward declarations as an extension. Such > > forward-declared enums will be represented as normal BTF_KIND_ENUM types > > with > > vlen=0. This patch adds abil

Re: [PATCH bpf-next 1/2] btf: resolve enum fwds in btf_dedup

2019-03-11 Thread Yonghong Song
On 3/10/19 5:44 PM, Andrii Nakryiko wrote: > GCC and clang support enum forward declarations as an extension. Such > forward-declared enums will be represented as normal BTF_KIND_ENUM types with > vlen=0. This patch adds ability to resolve such enums to their corresponding Thanks Andrii for repo

[PATCH bpf-next 1/2] btf: resolve enum fwds in btf_dedup

2019-03-10 Thread Andrii Nakryiko
GCC and clang support enum forward declarations as an extension. Such forward-declared enums will be represented as normal BTF_KIND_ENUM types with vlen=0. This patch adds ability to resolve such enums to their corresponding fully defined enums. This helps to avoid duplicated BTF type graphs which