[PATCH] btf: emit linkage information in BTF_KIND_FUNC entries

Jose E. Marchesi jose.marchesi@oracle.com
Tue Jul 12 15:12:33 GMT 2022

> On 7/8/22 11:30 AM, Jose E. Marchesi via Gcc-patches wrote:
>> The kernel bpftool expects BTF_KIND_FUNC entries in BTF to include an
>> annotation reflecting the linkage of functions (static, global).  For
>> whatever reason they (ab)use the `vlen' field of the BTF_KIND_FUNC entry
>> instead of adding a variable-part to the record like it is done with
>> other entry kinds.
> For BTF Variables, we have the linkage information in the output
> section as "btv_linkage".  To propagate that information from DWARF to
> BTF, we have the dvd_visibility in struct ctf_dvdef (in ctfc.h). Now
> that the linkage information is needed for the BTF_KIND_FUNC entries,
> what do you think about - adding something like dtd_visibility to
> ctf_dtdef.
> Updating the BTF format documentation will be useful
> https://www.kernel.org/doc/Documentation/bpf/btf.rst. Let's see what
> can be done for that...
> Also, adding some testcases with the current patch will be great.
> I have created PR debug/106263 "BTF_KIND_FUNC type does not encode
> linkage" to track this.

Sending V2 with the requested changes.

More information about the Gcc-patches mailing list