Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 3:43 PM Florent Revest wrote: > > On Tue, Mar 16, 2021 at 5:36 AM Andrii Nakryiko > wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > +#define ___bpf_build_param0(narg, x) > > > +#define ___bpf_build_param1(narg, x) ___param[narg - 1] = x > > > +#defi

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-16 Thread Florent Revest
On Tue, Mar 16, 2021 at 5:36 AM Andrii Nakryiko wrote: > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > +#define ___bpf_build_param0(narg, x) > > +#define ___bpf_build_param1(narg, x) ___param[narg - 1] = x > > +#define ___bpf_build_param2(narg, x, args...) ___param[narg - 2] = x; \ >

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-15 Thread Andrii Nakryiko
On Mon, Mar 15, 2021 at 9:36 PM Andrii Nakryiko wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > > When initializing the __param array with a one liner, if all args are > > const, the initial array value will be placed in the rodata section but > > because libbpf does not su

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > When initializing the __param array with a one liner, if all args are > const, the initial array value will be placed in the rodata section but > because libbpf does not support relocation in the rodata section, any > pointer in this array

[PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-10 Thread Florent Revest
When initializing the __param array with a one liner, if all args are const, the initial array value will be placed in the rodata section but because libbpf does not support relocation in the rodata section, any pointer in this array will stay NULL. This is a workaround, ideally the rodata relocat