On Sun, Jan 24, 2021 at 2:18 PM Jiri Olsa [off-list ref] wrote:
For very large ELF objects (with many sections), we could
get special value SHN_XINDEX (65535) for symbol's st_shndx.
This patch is adding code to detect the optional extended
section index table and use it to resolve symbol's section
index.
Adding elf_symtab__for_each_symbol_index macro that returns
symbol's section index and usign it in collect functions.
Tested by running pahole on kernel compiled with:
make KCFLAGS="-ffunction-sections -fdata-sections" -j$(nproc) vmlinux
and ensure FUNC records are generated and match normal
build (without above KCFLAGS).
Also bpf selftest passed and generated kernel BTF,
is same as without the patch.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
Acked-by: Andrii Nakryiko <andrii@kernel.org>
btf_encoder.c | 33 +++++++++++++++++----------------
elf_symtab.c | 41 +++++++++++++++++++++++++++++++++++++++--
elf_symtab.h | 29 +++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 18 deletions(-)
[...]