https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125888
--- Comment #1 from Vineet Gupta <vineetg at gcc dot gnu.org> --- Clang recently started supporting this commit 5754a48780f516cbc06eeb2a31b1e445ddd9c935 Author: yonghong-song <[email protected]> Date: Mon Jun 15 10:51:02 2026 -0700 [Clang][BPF] Support btf_type_tag on typedef underlying types (#203089) Emil Tsalapatis suggested to add type tag for typedef like below: ``` $ cat tag.c #define __type_tag(x) __attribute__((btf_type_tag(x))) struct bar { int c; int d; }; typedef struct bar __type_tag("a") bar_t; int use(bar_t *v) { return v->c + v->d; } ``` This makes the code simpler -- using `bar_t *v` instead of the longer form `struct bar __type_tag("a") *v`. So the goal is to allow type tag for typedef underlying types. The following describes the main changes: - CGDebugInfo: factor the btf_type_tag walk out of CreatePointerLikeType into a new CollectBTFTypeTagAnnotations() helper, and use it when emitting a typedef's DIDerivedType so the typedef carries both its btf_decl_tag annotations (on the declaration) and the btf_type_tag annotations (on the underlying type). - BPF BTFDebug: emit type tags for DW_TAG_typedef the same way they are emitted for DW_TAG_pointer_type, building the intermediate BTF_KIND_TYPE_TAG chain. The BTFTypeDerived constructor now selects BTF_KIND_PTR or BTF_KIND_TYPEDEF based on the DWARF tag.
