Message ID | 20250122025308.2717553-3-ihor.solodrai@pm.me (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | BTF: arbitrary __attribute__ encoding | expand |
On 22/01/2025 02:53, Ihor Solodrai wrote: > If the kflag is set for a BTF type tag, then the tag represents an > arbitrary __attribute__. Change btf_dump accordingly. > > Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> > --- > tools/lib/bpf/btf_dump.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c > index a3fc6908f6c9..460c3e57fadb 100644 > --- a/tools/lib/bpf/btf_dump.c > +++ b/tools/lib/bpf/btf_dump.c > @@ -1494,7 +1494,10 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, > case BTF_KIND_TYPE_TAG: > btf_dump_emit_mods(d, decls); > name = btf_name_of(d, t->name_off); > - btf_dump_printf(d, " __attribute__((btf_type_tag(\"%s\")))", name); > + if (btf_kflag(t)) > + btf_dump_printf(d, " __attribute__((%s))", name); > + else > + btf_dump_printf(d, " __attribute__((btf_type_tag(\"%s\")))", name); > break; > case BTF_KIND_ARRAY: { > const struct btf_array *a = btf_array(t);
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index a3fc6908f6c9..460c3e57fadb 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -1494,7 +1494,10 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, case BTF_KIND_TYPE_TAG: btf_dump_emit_mods(d, decls); name = btf_name_of(d, t->name_off); - btf_dump_printf(d, " __attribute__((btf_type_tag(\"%s\")))", name); + if (btf_kflag(t)) + btf_dump_printf(d, " __attribute__((%s))", name); + else + btf_dump_printf(d, " __attribute__((btf_type_tag(\"%s\")))", name); break; case BTF_KIND_ARRAY: { const struct btf_array *a = btf_array(t);
If the kflag is set for a BTF type tag, then the tag represents an arbitrary __attribute__. Change btf_dump accordingly. Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me> --- tools/lib/bpf/btf_dump.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)