dso__load_sym_internal() had no filtering for .L* and L0* mapping
symbols while the kallsyms path already filters them via
is_ignored_kernel_symbol().
Add the same check gated by dso__kernel() so that kernel ELF objects
(vmlinux, .ko) have mapping symbols filtered across all architectures,
but userspace ELF objects are unaffected -- '$' is a valid prefix in
languages like Java and Scala.
The existing ARM/AArch64 and RISC-V architecture-specific mapping symbol
checks are preserved; the new is_ignored_kernel_symbol() check adds x86
local symbol (.L*, L0*) filtering and provides unified
cross-architecture coverage for kernel DSOs.
Signed-off-by: Rui Qi <qirui.001@bytedance.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
if (!is_label && !elf_sym__filter(&sym))
continue;
- /* Reject ARM ELF "mapping symbols": these aren't unique and
+ /*
+ * Reject ARM ELF "mapping symbols": these aren't unique and
* don't identify functions, so will confuse the profile
- * output: */
+ * output:
+ */
if (ehdr.e_machine == EM_ARM || ehdr.e_machine == EM_AARCH64) {
if (elf_name[0] == '$' && strchr("adtx", elf_name[1])
&& (elf_name[2] == '\0' || elf_name[2] == '.'))
continue;
}
+ /* Reject kernel mapping symbols for kernel DSOs only */
+ if (dso__kernel(dso) && is_ignored_kernel_symbol(elf_name))
+ 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;