On 23/08/2024 22:28, Will Hawkins wrote: > Handle static and external linkage for BTF subprograms (functions). > This looks good to me Will, thanks! A small nit is that it might be worth mentioning explicitly in the commit that BTF_FUNC_GLOBAL linkage is ignored since it does not require a linkage modifier for the function, but.. > Signed-off-by: Will Hawkins <hawkinsw@xxxxxx> Reviewed-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > --- > btf_loader.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/btf_loader.c b/btf_loader.c > index e0d029a..488c757 100644 > --- a/btf_loader.c > +++ b/btf_loader.c > @@ -30,6 +30,9 @@ > #include "dutil.h" > #include "dwarves.h" > > +static char btf_linkage_name_static[] = "static"; > +static char btf_linkage_name_extern[] = "extern"; > + > static const char *cu__btf_str(struct cu *cu, uint32_t offset) > { > return offset ? btf__str_by_offset(cu->priv, offset) : NULL; > @@ -87,6 +90,11 @@ static int create_new_function(struct cu *cu, const struct btf_type *tp, uint32_ > // for BTF this is not really the type of the return of the function, > // but the prototype, the return type is the one in type_id > func->btf = 1; > + if (BTF_INFO_VLEN(tp->info) == BTF_FUNC_STATIC) > + func->linkage_name = btf_linkage_name_static; > + else if (BTF_INFO_VLEN(tp->info) == BTF_FUNC_EXTERN) > + func->linkage_name = btf_linkage_name_extern; > + func->external = BTF_INFO_VLEN(tp->info) == BTF_FUNC_EXTERN; > func->proto.tag.tag = DW_TAG_subprogram; > func->proto.tag.type = tp->type; > func->name = cu__btf_str(cu, tp->name_off);