btf_encoder: Introduce elf_functions_list

In case of processing of multiple DWARF modules, multiple ELFs are read.
This requires maintaining and elf_functions table per ELF.

Replace btf_encoder.functions with btf_encoder.elf_functions_list, that
contains all necessary elf_functions tables.

The list is initialized when btf_encoder is created. When a new CU is
assigned to the encoder in btf_encoder__encode_cu, an elf_functions
table will be created if the CU is coming from an unknown Elf.

This patch is a variant of [1], following a discussion at [2].

[1] https://lore.kernel.org/bpf/20241213223641.564002-7-ihor.solodrai@pm.me/
[2] https://lore.kernel.org/bpf/C82bYTvJaV4bfT15o25EsBiUvFsj5eTlm17933Hvva76CXjIcu3gvpaOCWPgeZ8g3cZ-RMa8Vp0y1o_QMR2LhPB-LEUYfZCGuCfR_HvkIP8=@pm.me/

Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
Cc: Alan Maguire <alan.maguire@oracle.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mykola Lysenko <mykolal@fb.com>
Link: https://lore.kernel.org/r/20250109185950.653110-6-ihor.solodrai@pm.me
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed