[RFC dwarves 0/6] prep for compiler-generated BTF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series is intended to help pave the way to allow pahole to
handle compiler-generated BTF as input to its encoding process.

The BTF loader currently supports loading BTF for data structure
and function query but not for BTF generation.  [1] describes how
gcc can generate (and the linker deduplicate) BTF but even there
we will need pahole to post-process the results so it is valuable
to support reading BTF in pahole as input to start exploring how
to handle cases like [1].

The intention of this series is not yet to fully support
linker-deduplicated BTF, but to start down that road by supporting
reading BTF from (multiple) object files and support its deduplication
and BTF output.  To that end a few changes are needed in the
intermediate representation generated by the BTF loader; these are
done in patch 1.  Patch 2 then fixes up a few cases where we needed
to special-case the intermediate representation when it came from
BTF.  Patches 3/4 ensure that we retrieve ELF info when loading BTF
for encoding.  Patch 5 is intended to support cases where we read BTF from
multiple objects and - if the "encode_force" BTF feature is specified -
we continue as long as BTF is found in at least one of those sources.
Finally patch 6 tests pahole when BTF is used as input.

This allows us to experiment with "gcc -gbtf".  For example adding
-gbtf to the KCFLAGS environment variable for a kernel build, we can
then run pahole across the set of vmlinux objects via

pahole --format_path=btf -J --btf_features=encode_force \
        --btf_encode_detached=/tmp/vmlinux.btf $(ar t vmlinux.a)

This is clearly not the right way to do this for kernel builds -
we want to make use of linker deduplication as in [1] - but the fact
that even a hack like this works does demonstrate the viability of
handling BTF as input to vmlinux BTF encoding.  It also allows us
to provide a comparison between compiler-generated BTF with pahole
deduplication and compiler-generated BTF with linker deduplication
when the latter becomes available.

[1] https://lore.kernel.org/dwarves/87ldqf1i19.fsf@xxxxxxxxxxxxx/

Alan Maguire (6):
  btf_loader: Make BTF representation match DWARF
  pfunct: Fix up function display with updated prototype representation
  pahole: Add btf_encode to conf_load
  btf_loader: read ELF for BTF encoding
  btf_encoder: Do not error out if BTF is not found in some input files
  tests: Add test of pahole using BTF as input to BTF generation

 btf_loader.c       |  36 +++++++++++--
 dwarves.c          |  14 +++++-
 dwarves.h          |   1 +
 dwarves_fprintf.c  |   2 +-
 pahole.c           |  15 +++---
 pfunct.c           |   2 +-
 tests/btf_2_btf.sh | 122 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 176 insertions(+), 16 deletions(-)
 create mode 100755 tests/btf_2_btf.sh

-- 
2.43.5





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux