mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibELF: Ignore mapping symbols when symbolicating RISC-V ELFs
This commit is contained in:
parent
120d6b2f21
commit
6d48b6724d
1 changed files with 5 additions and 4 deletions
|
@ -421,12 +421,13 @@ Optional<Image::Symbol> Image::find_symbol(FlatPtr address, u32* out_offset) con
|
|||
NEVER_INLINE void Image::sort_symbols() const
|
||||
{
|
||||
m_sorted_symbols.ensure_capacity(symbol_count());
|
||||
bool const is_aarch64 = header().e_machine == EM_AARCH64;
|
||||
for_each_symbol([this, is_aarch64](auto const& symbol) {
|
||||
// The AArch64 ABI marks the boundaries of literal pools in a function with $x/$d.
|
||||
bool const is_aarch64_or_riscv = header().e_machine == EM_AARCH64 || header().e_machine == EM_RISCV;
|
||||
for_each_symbol([this, is_aarch64_or_riscv](auto const& symbol) {
|
||||
// The AArch64 and RISC-V ABIs mark the boundaries of literal pools in a function with $x/$d.
|
||||
// https://github.com/ARM-software/abi-aa/blob/2023q1-release/aaelf64/aaelf64.rst#mapping-symbols
|
||||
// https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#mapping-symbol
|
||||
// Skip them so we don't accidentally print these instead of function names.
|
||||
if (is_aarch64 && (symbol.name().starts_with("$x"sv) || symbol.name().starts_with("$d"sv)))
|
||||
if (is_aarch64_or_riscv && (symbol.name().starts_with("$x"sv) || symbol.name().starts_with("$d"sv)))
|
||||
return;
|
||||
// STT_SECTION has the same address as the first function in the section, but shows up as the empty string.
|
||||
if (symbol.type() == STT_SECTION)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue