]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gprofng: Refactor readSymSec for using BFD's asymbol struct
authorClaudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Fri, 28 Mar 2025 11:33:26 +0000 (13:33 +0200)
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Mon, 7 Apr 2025 01:23:55 +0000 (18:23 -0700)
commit13f614be23ab6ef1018ddf9c133175e806e68ed8
tree1a69b19fac1b7d5bee158d15fb858643b02c47e3
parent91fd5244999ecab8f24728a3e033689e1c668f7e
gprofng: Refactor readSymSec for using BFD's asymbol struct

This patch refactors a number of gprofng internal functions for using
more BFD data types and functions.
Stabs::readSymSec is a function which reads the symbols of an ELF file
mapping them into an internal structure. To use BFD asymbols, the
Elf::elf_getsym is changed from custom reading of the symbols from
.symtab and .dynsym section to BFD enable functions. A new function is
introduced which returns the number of either static or dynamic symbols,
named Elf::elf_getSymCount. Both Elf functions are used by
Stabs::readSymSec refactoring.

Also, this patch removes reading symbols, SUNW_ldnsym section as it is
only used by now defunct Studio compiler. However, it adds the reading
of both static and dynamic symbols, previously, only either one was
processed.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
gprofng/src/DwarfLib.cc
gprofng/src/Elf.cc
gprofng/src/Elf.h
gprofng/src/Stabs.cc
gprofng/src/Stabs.h