Page MenuHomePhabricator

[BPF] support btf_tag attribute in .BTF section
ClosedPublic

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

Details

Summary

A new kind BTF_KIND_TAG is added to .BTF to encode
btf_tag attributes. The format looks like

CommonType.name : attribute string
CommonType.type : attached to a struct/union/func/func_proto/var.
CommonType.info : 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
llvm/lib/Target/BPF/BTF.h
109

s/attr/tag/ ?

116

s/ATTR/TAG/?

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

llvm/lib/Target/BPF/BTF.h
109

ya.

116

ya.

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.