From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: dwarves@vger.kernel.org, arnaldo.melo@gmail.com,
bpf@vger.kernel.org, kernel-team@fb.com, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org,
yonghong.song@linux.dev, Alan Maguire <alan.maguire@oracle.com>,
Daniel Xu <dxu@dxuuu.xyz>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Vadim Fedorenko <vadfed@meta.com>
Subject: Re: [PATCH dwarves v1] btf_encoder: handle .BTF_ids section endianness when cross-compiling
Date: Tue, 26 Nov 2024 16:30:47 -0800 [thread overview]
Message-ID: <8744c86ba355245f7ecc14d00351c82285fbf644.camel@gmail.com> (raw)
In-Reply-To: <CAEf4Bzb-PMAs7+B85qanUinQrk4aVs4Qk6orbyDP11uBcW-mWA@mail.gmail.com>
On Tue, 2024-11-26 at 13:51 -0800, Andrii Nakryiko wrote:
[...]
> > When I tried 'data->d_type = ELF_T_WORD' + gelf_xlatetom() snippet
> > suggested by Tony Ambardar some time ago, I got a write protection error.
> > Concluded that this is so, because file is opened in O_RDONLY mode.
>
> Ok, maybe don't follow my words *exactly*, just in spirit ;) I see
> there is elf_getdata_rawchunk() API in libelf, which seems useful:
>
> /* Get data translated from a chunk of the file contents as section data
> would be for TYPE. The resulting Elf_Data pointer is valid until
> elf_end (ELF) is called. */
> extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
> int64_t __offset, size_t __size,
> Elf_Type __type);
>
> I don't know the surrounding code, I was just hoping to leverage
> libelf's byte swapping support (which I think I learned from Tony as
> well). But if it's too inconvenient, so be it.
I missed this API, it works and makes the patch much smaller,
thank you for finding it.
prev parent reply other threads:[~2024-11-27 0:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 7:02 [PATCH dwarves v1] btf_encoder: handle .BTF_ids section endianness when cross-compiling Eduard Zingerman
2024-11-22 15:03 ` Vadim Fedorenko
2024-11-22 15:11 ` Jiri Olsa
2024-11-22 18:08 ` Eduard Zingerman
2024-11-22 18:16 ` Eduard Zingerman
2024-11-26 19:26 ` Andrii Nakryiko
2024-11-26 19:31 ` Eduard Zingerman
2024-11-26 21:51 ` Andrii Nakryiko
2024-11-27 0:30 ` Eduard Zingerman [this message]
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=8744c86ba355245f7ecc14d00351c82285fbf644.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=arnaldo.melo@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dwarves@vger.kernel.org \
--cc=dxu@dxuuu.xyz \
--cc=kernel-team@fb.com \
--cc=memxor@gmail.com \
--cc=vadfed@meta.com \
--cc=yonghong.song@linux.dev \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox