From: Alan Maguire <redacted>
With CONFIG_DEBUG_INFO_BTF=m the vmlinux BTF is not part of the kernel
image but carried by a module, and the kernel has to know, before that
module is loaded, which module that is, how large the BTF is and which
BTF it was built with. It keeps that in a .BTF.link record (struct
btf_link): the name of the module, NUL-padded to the target's
__MODULE_NAME_LEN, the SHA-256 of the BTF, and its size in the byte
order of the target. Inline BTF delivered as a module, a planned
follow-up, needs the same for its own section, in .BTF.inline.link.
Fill these records in where .BTF_ids is patched, after the final link,
when the BTF is final: the --patch_btfids pass takes one or more
--btf_link <section>:<module>:<raw BTF file>
[ ... ]
inline BTF changes; take the ELF class and byte order from the ELF
header in patch_btf_link() rather than from elf_collect(), set up libelf
there too, report each failure, refuse an overlong section name and
--btf_link without --patch_btfids, document the option]
Signed-off-by: Jay Wang <redacted>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001225214.12351-1-wanjay@amazon.com?part=10