aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHaibo Xu <haibo1.xu@intel.com>2025-04-09 10:51:56 +0800
committerPalmer Dabbelt <palmer@dabbelt.com>2025-06-05 11:10:16 -0700
commit4d6319289e8661a1845dde5d05859afc21ec3ed9 (patch)
treeb4fff6ff339bbe8b069289dfbc38430ba8654135 /tools
parentMerge patch series "riscv: kexec_file: Support loading Image binary file" (diff)
downloadlinux-rng-4d6319289e8661a1845dde5d05859afc21ec3ed9.tar.xz
linux-rng-4d6319289e8661a1845dde5d05859afc21ec3ed9.zip
perf symbols: Ignore mapping symbols on riscv
RISCV ELF use mapping symbols with special names $x, $d to identify regions of RISCV code or code with different ISAs[1]. These symbols don't identify functions, so will confuse the perf output. The patch filters out these symbols at load time, similar to "4886f2ca perf symbols: Ignore mapping symbols on aarch64". [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/ master/riscv-elf.adoc#mapping-symbol Signed-off-by: Haibo Xu <haibo1.xu@intel.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20250409025202.201046-1-haibo1.xu@intel.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/symbol-elf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index fbf6d0f73af9..55b1409b0593 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1733,6 +1733,12 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
continue;
}
+ /* Reject RISCV ELF "mapping symbols" */
+ if (ehdr.e_machine == EM_RISCV) {
+ if (elf_name[0] == '$' && strchr("dx", elf_name[1]))
+ continue;
+ }
+
if (runtime_ss->opdsec && sym.st_shndx == runtime_ss->opdidx) {
u32 offset = sym.st_value - syms_ss->opdshdr.sh_addr;
u64 *opd = opddata->d_buf + offset;