Dwarves Archive on lore.kernel.org
 help / color / Atom feed
From: Tony Ambardar <tony.ambardar@gmail.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	bpf <bpf@vger.kernel.org>,
	dwarves@vger.kernel.org
Subject: Re: Problem with endianess of pahole BTF output for vmlinux
Date: Sat, 19 Sep 2020 00:58:39 -0700
Message-ID: <CAPGftE8jNys9aVfUZW2iE5vB=QWKEmmwwWuWq9ek0ZXp-Aobkg@mail.gmail.com> (raw)
In-Reply-To: <20200909142750.GC3788224@kernel.org>

On Wed, 9 Sep 2020 at 07:27, Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Wed, Sep 09, 2020 at 11:02:24AM +0200, Ilya Leoshkevich escreveu:
> > On Tue, 2020-09-08 at 13:18 -0700, Andrii Nakryiko wrote:
> > > On Mon, Sep 7, 2020 at 9:02 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> > > > On Sat, 2020-09-05 at 21:16 -0700, Tony Ambardar wrote:
>
[...]
> > > > > Is this expected? Is DEBUG_INFO_BTF supported in general when
> > > > > cross-compiling? How does one generate BTF encoded for the
> > > > > target endianness with pahole?
>
> The BTF loader has support for endianness, its just the encoder that
> doesn't :-\
>
> I.e. pahole can grok a big endian BTF payload on a little endian machine
> and vice-versa, just can't cross-build BTF payloads ATM.
>
> > > Yes, it's expected, unfortunately. Right now cross-compiling to a
> > > different endianness isn't supported. You can cross-compile only if
> > > target endianness matches host endianness.
>
> I agree that having this in libbpf is better, it should be done as part
> of producing the result of the deduplication phase.
>
Thanks for confirming this wasn't a case of operator error. My platforms for
learning/experimenting with BPF have been small embedded ones, including
cross-compiling to different archs, word-size and endianness, which have
"helped" me run into multiple problems till now. This one is the first I
couldn't work around however...

[...]
> > > I'm working on extending BTF APIs in libbpf at the moment. Switching
> > > endianness would be rather easy once all that is done. With these new
> > > APIs it will be possible to switch pahole to use libbpf APIs to
> > > produce BTF output and support arbitrary endianness as well. Right
> > > now, I'd rather avoid implementing this in pahole, libbpf is a much
> > > better place for this (and will require ongoing updates if/when we
> > > introduce new types and fields to BTF).
>
> Right, we could do it right after btf_dedup() and before
> btf_elf__write(), doing the same process as in btf_loader.c, i.e.
> checking if the ELF target arch is different in endianness and doing the
> reverse of the loader.
>
> > > Hope this plan works for you guys.
> >
> > That sounds really good to me, thanks!
>
Andrii and Arnaldo, I really appreciate your working on a proper endianness fix.
If you have a WIP or staging branch and could use some help please let me know.

Best regards,
Tony

       reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAPGftE8ipAacAnm9xMHFabXCL-XrCXGmOsX-Nsjvz9wnh3Zx-w@mail.gmail.com>
     [not found] ` <9e99c5301fbbb4f5f601b69816ee1dc9ab0df948.camel@linux.ibm.com>
     [not found]   ` <CAEf4Bza9tZ-Jj0dj9Ne0fmxa95t=9XxxJR+Ce=6hDmw_d8uVFA@mail.gmail.com>
     [not found]     ` <8cf42e2752e442bb54e988261d8bf3cd22ad00f2.camel@linux.ibm.com>
     [not found]       ` <20200909142750.GC3788224@kernel.org>
2020-09-19  7:58         ` Tony Ambardar [this message]
2020-09-21 18:19           ` Andrii Nakryiko
2020-09-28 20:18             ` Andrii Nakryiko
2020-09-28 20:27               ` Luka Perkov
2020-09-29  3:41               ` Tony Ambardar
2020-09-29  4:15                 ` Andrii Nakryiko
2020-09-29  6:48                   ` Tony Ambardar
2020-09-29 17:36                     ` Juraj Vijtiuk
2020-09-29 17:57                     ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPGftE8jNys9aVfUZW2iE5vB=QWKEmmwwWuWq9ek0ZXp-Aobkg@mail.gmail.com' \
    --to=tony.ambardar@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=arnaldo.melo@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=iii@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Dwarves Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dwarves/0 dwarves/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dwarves dwarves/ https://lore.kernel.org/dwarves \
		dwarves@vger.kernel.org
	public-inbox-index dwarves

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dwarves


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git