On Thu, Sep 10, 2020 at 12:59 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Wed, Sep 9, 2020 at 11:25 AM Stanislav Fomichev <sdf@xxxxxxxxxx> wrote: > > > > From: YiFei Zhu <zhuyifei@xxxxxxxxxx> > > > > This is a simple test to check that loading and dumping metadata > > in btftool works, whether or not metadata contents are used by the > > program. > > > > A C test is also added to make sure the skeleton code can read the > > metadata values. > > > > Cc: YiFei Zhu <zhuyifei1999@xxxxxxxxx> > > Signed-off-by: YiFei Zhu <zhuyifei@xxxxxxxxxx> > > Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx> > > --- > > It would be good to test that libbpf does bind .rodata even if BPF > program doesn't use it. So for metadata_unused you can get > bpf_prog_info and check that it does contain the id of .rodata? Good idea, will add that. > > +const char bpf_metadata_a[] SEC(".rodata") = "foo"; > > +const int bpf_metadata_b SEC(".rodata") = 1; > > please add volatile to ensure these are not optimized away Ack, ty!