This is an archive of the discontinued LLVM Phabricator instance.

[BPF] support btf_tag attribute in .BTF section

Authored by yonghong-song on Jul 22 2021, 5:39 PM.



A new kind BTF_KIND_TAG is added to .BTF to encode
btf_tag attributes. The format looks like : attribute string
CommonType.type : attached to a struct/union/func/func_proto/var. : encoding BTF_KIND_TAG
                      kflag == 1 to indicate the attribute is
                      for CommonType.type, or kflag == 0
                      for struct/union member or func argument.
one uint32_t    : to encode which member/argument starting from 0.

If one particular type or member/argument has more than one attribute,
multiple BTF_KIND_TAG will be generated.

Diff Detail

Event Timeline

yonghong-song created this revision.Jul 22 2021, 5:39 PM
yonghong-song requested review of this revision.Jul 22 2021, 5:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2021, 5:39 PM
yonghong-song edited the summary of this revision. (Show Details)

For func argument, ATTR commonType.type points to FUNC instead of FUNC_PROTO.

anakryiko added inline comments.Jul 27 2021, 4:03 PM

s/attr/tag/ ?



I may have some other inconsistencies. I will double check all in the next revision.





yonghong-song edited the summary of this revision. (Show Details)
  • fix a few inconsistencies in comments (some of them spotted by Andrii)
anakryiko accepted this revision.Aug 2 2021, 12:48 PM

LGTM from the BTF definition standpoint.

This revision is now accepted and ready to land.Aug 2 2021, 12:48 PM
  • rebase on top of master
  • add support for callsite subprogram (extern function)
This revision was landed with ongoing or failed builds.Aug 28 2021, 9:03 PM
This revision was automatically updated to reflect the committed changes.