https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125888

            Bug ID: 125888
           Summary: btf_type_tag for types not supported for defined
                    struct
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
                CC: dfaust at gcc dot gnu.org, jemarch at gcc dot gnu.org
  Target Milestone: ---

This was brought up by Emil@meta and seems like a legit feature request.

For an existing generic kernel structure, users might want to define a
specialized type with a custom btf_type_tag attached, e.g.

```
typedef struct rbtree __arena rbtree_t;
```

Currently gcc ignores this and emits -Wattributes warning

test.c:7:16: warning: ignoring attributes applied to ‘struct rbtree’ after
definition [-Wattributes]

The workaround is to specify struct def when creating the type which obviously
doesn't work for existing structs in kernel headers.

FWIW independent of this request - when enabling decl/type tags in Linux kernel
with gcc 16+ (containing decl gcc tag support from David) we get a lot of build
spew for percpu variables.

```
struct cpuinfo_x86 {
   unsigned initialized;
};

extern __attribute__((btf_type_tag("percpu")))
__attribute__((section(".data..percpu" "..read_mostly")))
__typeof__(struct cpuinfo_x86) cpu_info;
```

Reply via email to