Previously, btf_del_tag attribute supports record, field, global variable,
function and function parameter ([1], [2]). This patch added support for typedef.
The main reason is for typedef of an anonymous struct/union, we can only apply
btf_decl_tag attribute to the anonymous struct/union like below:
typedef struct { ... } __btf_decl_tag target_type
In this case, the __btf_decl_tag attribute applies to anonymous struct,
which increases downstream implementation complexity. But if
typedef with btf_decl_tag attribute is supported, we can have
typedef struct { ... } target_type __btf_decl_tag
which applies __btf_decl_tag to typedef "target_type" which make it
easier to directly associate btf_decl_tag with a named type.
This patch permitted btf_decl_tag with typedef types with this reason.
What worries me about this is that this is now a decl *or* type attribute and one of the subjects is a typedef name which can be either a type or a decl. However, this attribute has no type semantics currently -- the only reason it's allowed on a type at all is because the Linux kernel seems to use it for cast operations, but we don't support that (we just parse it and ignore it). But then what are the semantics when used on a typedef if we want to actually support that casting case in the future?
(This is one of the reasons why GNU attributes are so incredibly difficult to use in practice -- their ability to "slide" around to whatever makes the most sense based on the name of the attribute means you run into these situations and have to work hard to tease out the desired semantics.)