Thread (35 messages) 35 messages, 2 authors, 2021-02-17
STALE1965d
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH dwarves v2 0/4] BTF ELF writing changes

From: Giuliano Procida <hidden>
Date: 2021-02-01 17:26:25

Note: The 4 patches in this series supersede patches 2-4 of the
previous version of this series (patch 1 was applied).

pahole -J currently uses llvm-objcopy to add .BTF as a section (and
segment) to an ELF object containing DWARF debug information. If a
.BTF section is already present it is rewritten but segment
information is not updated.

In terms of the current Linux linker script, all that's needed is
either a dump of the raw BTF or a file containing a .BTF section. This
is because the script dumps .BTF out to a file, creates a
single-section ELF file and then links this into a final vmlinux.

The first commit in this series removes the dependency on
llvm-objcopy.

The remaining commits attempt to roughly duplicate the desired end
result, namely adding a .BTF section which is also a loadable segment.
They may not be sufficient. In terms of non-kernel .BTF use, they are
probably not necessary.

Nevertheless, this was an interesting exercise and removing the
llvm-objcopy dependency is a worthwhile goal.

I'm not well-placed to test the viability of vmlinux with .BTF as
generated by these patches, so any feedback is very welcome.

Giuliano Procida (4):
  btf_encoder: Add .BTF section using libelf
  btf_encoder: Manually lay out updated ELF sections
  btf_encoder: Add .BTF as a loadable segment
  btf_encoder: Align .BTF section/segment to 8 bytes

 libbtf.c | 240 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 197 insertions(+), 43 deletions(-)

-- 
2.30.0.365.g02bc693789-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help