hi, because of gcc bug [1] we can no longer rely on DW_AT_declaration attribute to filter out declarations and end up with just one copy of the function in the BTF data. It seems this bug is not easy to fix, but regardless if the it's coming soon, it's probably good idea not to depend so much only on dwarf data and make some extra checks. Thus for function encoding we are now doing following checks: - argument names are defined for the function - there's symbol and address defined for the function - function address belongs to ftrace locations (new in v2) - function is generated only once v3 changes: - added Hao's ack for patch 1 - fixed realloc memory leak [Andrii] - fixed addrs_cmp function [Andrii] - removed SET_SYMBOL macro [Andrii] - fixed the 'valid' function logic - added .init.bpf.preserve_type check - added iterator functions to new kernel section .init.bpf.preserve_type [Yonghong] v2 changes: - add check ensuring functions belong to ftrace's mcount locations, this way we ensure to have in BTF only functions available for ftrace - patch 2 changelog describes all details - use collect* function names [Andrii] - use conventional size increase in realloc [Andrii] - drop elf_sym__is_function check - drop patch 3, it's not needed, because we follow ftrace locations thanks, jirka [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060