[PATCH] D133361: [BPF] Attribute btf_decl_tag("ctx") for structs

Eduard Zingerman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 4 05:41:43 PDT 2023


eddyz87 added a comment.

In D133361#4629292 <https://reviews.llvm.org/D133361#4629292>, @ast wrote:

> ...
> Right. Such recursive propagation of PAI is necessary. For btf_tag we cannot do it. Always propagating it won't be correct.
> New preserve_const_field_offset would need to be propagated too and we actually have nested unions.
> __bpf_md_ptr is such example. btf_tag wouldn't propagate into that union, but attr(preserve_const_field_offset) should.

Hi Alexei,

It just occurred to me that such an attribute would also require DWARF and BTF encoding in order to get reflected in vmlinux.h (which we already have for btf_decl_tag). Given this I think we can rename decl tag "ctx" to `btf_decl_tag("preserve_const_field_offset")` but we should still keep it a `btf_decl_tag`. I'll try to replace usage of `bpf_context_marker` intrinsic by metadata, if that fails will just rename the intrinsic to `preserve_const_field_offset`.
What do you think? (Sorry, I should have thought this through last week).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133361/new/

https://reviews.llvm.org/D133361



More information about the cfe-commits mailing list