ast added a comment. In D133361#4629081 <https://reviews.llvm.org/D133361#4629081>, @eddyz87 wrote:
> Note on current propagation logic: whenever there is an expression E of type > T, where T is a struct annotated with btf_decl_tag("ctx"), all usages of E > are traversed recursively visiting `getelementptr` and calls to > `preserve_{struct,union,array}_index`, the latter are replaced by > `getelementptr`. E.g.: > > #define __pai __attribute__((preserve_access_context)); > #define __ctx __attribute__((btf_decl_tag("ctx"))) > struct bar { int a; int b; } __pai; > struct foo { > struct bar b; > } __ctx __pai; > ... struct foo f; ... > ... f.b.bb ... > > The call to `preserve_struct_index` generated for `bb` in `f.b.bb` would be > replaced by `getelementptr` and later by `getelementptr.and.load`. > However, context structures don't have nested structures at the moment. The > list of context structures is: > > - __sk_buff > - bpf_cgroup_dev_ctx > - bpf_sk_lookup > - bpf_sock > - bpf_sock_addr > - bpf_sock_ops > - bpf_sockopt > - bpf_sysctl > - sk_msg_md > - sk_reuseport_md > - xdp_md 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. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133361/new/ https://reviews.llvm.org/D133361 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits