Re: [PATCH bpf v1] bpf: fix libelf endian handling in resolv_btfids

Mark Wielaard
2021-06-17T10:44:48Z

On Thu, 2021-06-17 at 11:10 +0200, Jiri Olsa wrote:
> On Wed, Jun 16, 2021 at 03:09:13PM -0700, Tony Ambardar wrote:
> > On Wed, 16 Jun 2021 at 09:38, Jiri Olsa <jolsa@redhat.com> wrote:
> > > I have no idea how is this handled in libelf (perhaps it's ok),
> > > but just that comment above suggests it could be also 64 bits,
> > > cc-ing Frank and Mark for more insight
> > >
> >
> > One other area I'd like to confirm is with section compression. Is
> > it safe
> > to ignore this for .BTF_ids? I've done so because
> > include/linux/btf_ids.h
> > appears to define the section with SHF_ALLOC flag set, which is
> > incompatible with compression based on "libelf.h" comments.
>
> not sure what you mean.. where it wouldn't be safe?
> what workflow/processing

I haven't looked at the code/patch, but Tony is correct that if a
section has SHF_ALLOC set it cannot be a compressed section.
SHF_COMPRESSED is incompatbile with SHF_ALLOC (or SHF_NOBITS) sections,
because it would be unclear what a loader would need to do with them
(uncompress the data first, then map it, or map the compressed data as
is into memory).

So ignoring whether or not a section is compressed for SHF_ALLOC
sections is fine.

Cheers,

Mark