Skip to content

Commit 945f500

Browse files
committed
perf symbols: Handle 'N' symbols in /proc/kallsyms
I started seeing this in recent Fedora 42 kernels: # uname -a Linux number 6.16.3-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Aug 23 17:02:17 UTC 2025 x86_64 GNU/Linux # # perf test vmlinux 1: vmlinux symtab matches kallsyms : FAILED! # Rust is enabled and these were the symbols causing the above failure, i.e. found in vmlinux but not in /proc/kallsyms: $ grep -w N /proc/kallsyms 0000000000000000 N __pfx__RNCINvNtNtNtCsbDUBuN8AbD4_4core4iter8adapters3map12map_try_foldjNtCs6vVzKs5jPr6_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_ 0000000000000000 N _RNCINvNtNtNtCsbDUBuN8AbD4_4core4iter8adapters3map12map_try_foldjNtCs6vVzKs5jPr6_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_ $ So accept those 'N' symbols as well. About them, from 'man nm': "N" The symbol is a debugging symbol. "n" The symbol is in a non-data, non-code, non-debug read-only section. Reviewed-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent c1ead4b commit 945f500

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/perf/util/symbol.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ static enum dso_binary_type binary_type_symtab[] = {
107107
static bool symbol_type__filter(char __symbol_type)
108108
{
109109
// Since 'U' == undefined and 'u' == unique global symbol, we can't use toupper there
110+
// 'N' is for debugging symbols, 'n' is a non-data, non-code, non-debug read-only section.
111+
// According to 'man nm'.
112+
// 'N' first seen in:
113+
// ffffffff9b35d130 N __pfx__RNCINvNtNtNtCsbDUBuN8AbD4_4core4iter8adapters3map12map_try_foldjNtCs6vVzKs5jPr6_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
114+
// a seemingly Rust mangled name
110115
char symbol_type = toupper(__symbol_type);
111116
return symbol_type == 'T' || symbol_type == 'W' || symbol_type == 'D' || symbol_type == 'B' ||
112-
__symbol_type == 'u' || __symbol_type == 'l';
117+
__symbol_type == 'u' || __symbol_type == 'l' || __symbol_type == 'N';
113118
}
114119

115120
static int prefix_underscores_count(const char *str)

0 commit comments

Comments
 (0)