From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Giuliano Procida <gprocida@google.com>
Cc: dwarves@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Matthias Männich" <maennich@google.com>,
kernel-team@android.com, "Kernel Team" <kernel-team@fb.com>,
bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH dwarves v2 2/4] btf_encoder: Manually lay out updated ELF sections
Date: Thu, 4 Feb 2021 15:06:13 -0800 [thread overview]
Message-ID: <CAEf4BzYwNVnT_9d2sRxRtOMihfFuK+R5Adxx87iArDv_Rr7dbg@mail.gmail.com> (raw)
In-Reply-To: <CAGvU0HmHR0AXKT2=LyD6HWdr79JM9kWjLTZhajjUJx+p2QB0tA@mail.gmail.com>
On Thu, Feb 4, 2021 at 10:34 AM Giuliano Procida <gprocida@google.com> wrote:
>
> Hi.
>
> On Thu, 4 Feb 2021 at 04:13, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> >
> > On Mon, Feb 1, 2021 at 9:26 AM Giuliano Procida <gprocida@google.com> wrote:
> > >
> > > pahole -J needs to do the following to an ELF file:
> > >
> > > * add or update the ".BTF" section
> > > * maybe update the section name string table
> > > * update the Section Header Table (SHT)
> > >
> > > libelf either takes full control of layout or requires the user to
> > > specify offset, size and alignment of all new and updated sections and
> > > headers.
> > >
> > > To avoid libelf moving program segments in particular, we position the
> >
> > It's not clear to me what's wrong with libelf handling all the layout.
> > Even if libelf will move program segments around, what's the harm?
> > Does it break anything if we just let libelf do this?
> >
>
> It doesn't hurt the userspace case I care about. I've no idea what it
> means in terms of vmlinux.
>
> However, I wrote that text before I discovered that pahole -J isn't
> actually used to modify kernel images.
>
> One thing I haven't tried is to try to make .BTF loadable but leave
> placement to libelf.
I'd concentrate on getting rid of llvm-objcopy dependency first.
Making .BTF loadable is even riskier change and there is no use case
that relies on that today, so definitely worth to split that out.
>
> > > ".BTF" and section name string table (typically named ".shstrtab")
> > > sections after all others. The SHT always lives at the end of the file.
> > >
> > > Note that the last section in an ELF file is normally the section name
> > > string table and any ".BTF" section will normally be second last.
> > > However, if these sections appear earlier, then we'll waste some space
> > > in the ELF file when we rewrite them.
> > >
> > > Signed-off-by: Giuliano Procida <gprocida@google.com>
> > > ---
> > > libbtf.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> > > 1 file changed, 62 insertions(+), 2 deletions(-)
> > >
> >
> > [...]
next prev parent reply other threads:[~2021-02-04 23:07 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87a83353155506cc02141e6e4108d89aa4e7d284>
2021-02-01 17:25 ` [PATCH dwarves v2 0/4] BTF ELF writing changes Giuliano Procida
2021-02-01 17:25 ` [PATCH dwarves v2 1/4] btf_encoder: Add .BTF section using libelf Giuliano Procida
2021-02-04 4:10 ` Andrii Nakryiko
2021-02-04 18:29 ` Giuliano Procida
2021-02-01 17:25 ` [PATCH dwarves v2 2/4] btf_encoder: Manually lay out updated ELF sections Giuliano Procida
2021-02-04 4:13 ` Andrii Nakryiko
2021-02-04 18:34 ` Giuliano Procida
2021-02-04 23:06 ` Andrii Nakryiko [this message]
2021-02-01 17:25 ` [PATCH dwarves v2 3/4] btf_encoder: Add .BTF as a loadable segment Giuliano Procida
2021-02-02 10:54 ` Giuliano Procida
2021-02-01 17:25 ` [PATCH dwarves v2 4/4] btf_encoder: Align .BTF section/segment to 8 bytes Giuliano Procida
2021-02-04 4:10 ` Andrii Nakryiko
2021-02-04 15:11 ` Giuliano Procida
2021-02-04 15:11 ` [PATCH] btf_encoder: Align .BTF section " Giuliano Procida
2021-02-05 13:42 ` [PATCH dwarves v3 0/5] ELF writing changes Giuliano Procida
2021-02-05 13:42 ` [PATCH dwarves v3 1/5] btf_encoder: Funnel ELF error reporting through a macro Giuliano Procida
2021-02-08 22:20 ` Andrii Nakryiko
2021-02-05 13:42 ` [PATCH dwarves v3 2/5] btf_encoder: Do not use both structs and pointers for the same data Giuliano Procida
2021-02-08 22:23 ` Andrii Nakryiko
2021-02-09 14:52 ` Giuliano Procida
2021-02-05 13:42 ` [PATCH dwarves v3 3/5] btf_encoder: Traverse sections using a for-loop Giuliano Procida
2021-02-08 22:24 ` Andrii Nakryiko
2021-02-09 14:59 ` Giuliano Procida
2021-02-05 13:42 ` [PATCH dwarves v3 4/5] btf_encoder: Add .BTF section using libelf Giuliano Procida
2021-02-08 22:29 ` Andrii Nakryiko
2021-02-09 15:04 ` Giuliano Procida
2021-02-05 13:42 ` [PATCH dwarves v3 5/5] btf_encoder: Align .BTF section to 8 bytes Giuliano Procida
2021-02-08 22:29 ` Andrii Nakryiko
2021-02-09 15:05 ` Giuliano Procida
2021-02-17 11:07 ` [PATCH dwarves v4 0/5] ELF writing changes Giuliano Procida
2021-02-17 11:08 ` [PATCH dwarves v4 1/5] btf_encoder: Funnel ELF error reporting through a macro Giuliano Procida
2021-02-17 11:08 ` [PATCH dwarves v4 2/5] btf_encoder: Do not use both structs and pointers for the same data Giuliano Procida
2021-02-17 11:08 ` [PATCH dwarves v4 3/5] btf_encoder: Traverse sections using a for-loop Giuliano Procida
2021-02-17 11:08 ` [PATCH dwarves v4 4/5] btf_encoder: Add .BTF section using libelf Giuliano Procida
2021-02-17 11:08 ` [PATCH dwarves v4 5/5] btf_encoder: Align .BTF section to 8 bytes Giuliano Procida
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=CAEf4BzYwNVnT_9d2sRxRtOMihfFuK+R5Adxx87iArDv_Rr7dbg@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=acme@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=gprocida@google.com \
--cc=kernel-team@android.com \
--cc=kernel-team@fb.com \
--cc=maennich@google.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
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;
as well as URLs for NNTP newsgroup(s).