Skip to content

btf: support btf_type_tag attribute

Yonghong Song bpf dwarves 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 6 repliesIn review
  2. v14 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- reorg an if condition to reduce nesting level.
- add more comments to explain how to chain type tag types.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4libbpf: sync with latest libbpf repolib/bpf+1 -10 replies
2/4dutil: move DW_TAG_LLVM_annotation definition to dutil.hdutil.h dwarf_loader.c+4 -40 replies
3/4dwarf_loader: support btf_type_tag attributedwarf_loader.c dwarves.h pahole.c+173 -40 replies
4/4btf_encoder: support btf_type_tag attributebtf_encoder.c dwarves.h+12 -00 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndrii Nakryiko
SeriesA-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH dwarves v2 0/4] btf: support btf_type_tag attribute

btf_type_tag is a new llvm type attribute which is used similar to kernel __user/__rcu attributes. The format of btf_type_tag looks like
__attribute__((btf_type_tag("tag1")))
For the case where the attribute applied to a pointee like
#define __tag1 __attribute__((btf_type_tag("tag1"))) #define __tag2 __attribute__((btf_type_tag("tag2")))
int __tag1 * __tag1 __tag2 *g;
the information will be encoded in dwarf.

In BTF, the attribute is encoded as a new kind BTF_KIND_TYPE_TAG and latest bpf-next supports it.

The patch added support in pahole, specifically converts llvm dwarf btf_type_tag attributes to BTF types. Please see individual patches for details.

Changelog:
v1 -> v2:
- reorg an if condition to reduce nesting level.
- add more comments to explain how to chain type tag types.

Yonghong Song (4):
libbpf: sync with latest libbpf repo
dutil: move DW_TAG_LLVM_annotation definition to dutil.h
dwarf_loader: support btf_type_tag attribute
btf_encoder: support btf_type_tag attribute

 btf_encoder.c  |   7 +++
 dutil.h        |   4 ++
 dwarf_loader.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++---
 dwarves.h      |  38 +++++++++++++-
 lib/bpf        |   2 +-
 pahole.c       |   8 +++
 6 files changed, 190 insertions(+), 9 deletions(-)
Signature · 1 line
2.30.2