This adds support for "btf_decl_tag" annotations for arguments of extern functions. The changes are split into several commits:
- Triple::isBPF() utility method -- adds a simple utility method for llvm::Triple class;
- preserve btf_decl_tag for parameters of extern functions -- modifies CLang frontend to generate DILocalVariable entries with attached "btf_dec_tag" annotations for parameters of extern functions;
- generate btf_decl_tag records for params of extern functions -- modifies BPF backend to process "btf_decl_tag" annotations for parameters of extern functions.
Below are descriptions for the last two commits:
Preserve btf_decl_tag for parameters of extern functions
Generate DILocalVariable entries for parameters of extern functions, the "annotations" field of DILocalVariable is used to link "btf_decl_tag" annotation with the parameter.
Do this only for BPF backend as there are no other users for this information. Final DWARF is valid as "Appendix A" is very much lax in
what is allowed as attributes for "DW_TAG_formal_parameter":
DWARF does not in general require that a given debugging information entry contain a particular attribute or set of attributes. Instead, a DWARF producer is free to generate any, all, or none of the attributes ... other attributes ... may also appear in a given debugging information entry.
DWARF Debugging Information Format Version 5,
Appendix A: Attributes by Tag Value (Informative)
Page 251, Line 3.
Generate btf_decl_tag records for params of extern functions
After frontend changes in the following commit: "BPF: preserve btf_decl_tag for parameters of extern functions" same mechanics could be used to get the list of function parameters and associated btf_decl_tag entries for both extern and non-extern functions.
This commit extracts this mechanics as a separate auxiliary function BTFDebug::processDISubprogram(). The function is called for both
extern and non-extern functions in order to generated corresponding BTF_DECL_TAG records.
Looks like this is for bpf only? Can we extend it to non-bpf as well? Currently, I think most use case, if any, will be in vmlinux (e.g., for struct_ops callback, etc).