https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113453
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Cupertino Miranda <cuper...@gcc.gnu.org>: https://gcc.gnu.org/g:77142bdba485057550c5d849864948b0d20be8af commit r14-9224-g77142bdba485057550c5d849864948b0d20be8af Author: Cupertino Miranda <cupertino.mira...@oracle.com> Date: Mon Feb 12 17:46:03 2024 +0000 bpf: implementation of func_info in .BTF.ext. Kernel verifier complains in some particular cases for missing func_info implementation in .BTF.ext. This patch implements it. Strings are cached locally in coreout.cc to avoid adding duplicated strings in the string list. This string deduplication should eventually be moved to the CTFC functions such that this happens widely. With this implementation, the CO-RE relocations information was also simplified and integrated with the FuncInfo structures. gcc/Changelog: PR target/113453 * config/bpf/bpf.cc (bpf_function_prologue): Define target hook. * config/bpf/coreout.cc (brf_ext_info_section) (btf_ext_info): Move from coreout.h (btf_ext_funcinfo, btf_ext_lineinfo): Add struct. (bpf_core_reloc): Rename to btf_ext_core_reloc. (btf_ext): Add static variable. (btfext_info_sec_find_or_add, SEARCH_NODE_AND_RETURN) (bpf_create_or_find_funcinfo, bpt_create_core_reloc) (btf_ext_add_string, btf_funcinfo_type_callback) (btf_add_func_info_for, btf_validate_funcinfo) (btf_ext_info_len, output_btfext_func_info): Add function. (output_btfext_header, bpf_core_reloc_add) (output_btfext_core_relocs, btf_ext_init, btf_ext_output): Change to support new structs. * config/bpf/coreout.h (btf_ext_funcinfo, btf_ext_lineinfo): Move and change in coreout.cc. (btf_add_func_info_for, btf_ext_add_string): Add prototypes. gcc/testsuite/ChangeLog: PR target/113453 * gcc.target/bpf/btfext-funcinfo-nocore.c: Add. * gcc.target/bpf/btfext-funcinfo.c: Add. * gcc.target/bpf/core-attr-5.c: Fix regexp. * gcc.target/bpf/core-attr-6.c: Fix regexp. * gcc.target/bpf/core-builtin-fieldinfo-offset-1.c: Fix regexp. * gcc.target/bpf/core-section-1.c: Fix regexp.