* [PATCH v2 1/3] perf symbol: Fix symbol loading from libbfd
@ 2026-10-10 18:24 Namhyung Kim
2026-10-10 18:24 ` [PATCH v2 2/3] perf symbol: Add missing symsrc__destroy() for libbfd Namhyung Kim
2026-10-10 18:24 ` [PATCH v2 3/3] perf symbol: Set dso symtab type " Namhyung Kim
0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2026-10-10 18:24 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Sashiko
The dso__load() should return a positive number (number of symbols
loaded) when it succeded to load symbols. But dso__load_bfd_symbols()
only returns 0 and it's hard to check if it actually loaded symbols or
not. Let's return the value of dso__has_symbol() and check it in
dso__load() so that it can return 1 for success.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/sashiko-outbox-162540@kernel.org
Fixes: eac9a4342e5447cad ("perf symbols: Try reading the symbol table with libbfd")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/libbfd.c | 2 +-
tools/perf/util/symbol.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c
index a907d7c1ac948808..a4dcb406c79e9cee 100644
--- a/tools/perf/util/libbfd.c
+++ b/tools/perf/util/libbfd.c
@@ -463,7 +463,7 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
symbols__fixup_duplicate(dso__symbols(dso));
dso__set_adjust_symbols(dso, true);
- err = 0;
+ err = dso__has_symbols(dso);
out_free:
free(symbols);
out_close:
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 5d98888d068c741a..a394e742f9b18812 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1930,8 +1930,8 @@ int dso__load(struct dso *dso, struct map *map)
if (nsexit)
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
- if (bfdrc == 0) {
- ret = 0;
+ if (bfdrc > 0) {
+ ret = 1;
break;
}
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/3] perf symbol: Add missing symsrc__destroy() for libbfd
2026-10-10 18:24 [PATCH v2 1/3] perf symbol: Fix symbol loading from libbfd Namhyung Kim
@ 2026-10-10 18:24 ` Namhyung Kim
2026-10-10 18:24 ` [PATCH v2 3/3] perf symbol: Set dso symtab type " Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2026-10-10 18:24 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Sashiko
When libbfd loaded symbols and there's a pending syms_ss, it'd be lost
or overwrite existing symbols. Let's destroy it before breaking the
loop so that it can safely return from the function.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/sashiko-outbox-162540@kernel.org
Fixes: eac9a4342e5447cad ("perf symbols: Try reading the symbol table with libbfd")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index a394e742f9b18812..93045123cbbefdbd 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1931,6 +1931,10 @@ int dso__load(struct dso *dso, struct map *map)
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
if (bfdrc > 0) {
+ if (syms_ss) {
+ symsrc__destroy(syms_ss);
+ syms_ss = NULL;
+ }
ret = 1;
break;
}
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 3/3] perf symbol: Set dso symtab type for libbfd
2026-10-10 18:24 [PATCH v2 1/3] perf symbol: Fix symbol loading from libbfd Namhyung Kim
2026-10-10 18:24 ` [PATCH v2 2/3] perf symbol: Add missing symsrc__destroy() for libbfd Namhyung Kim
@ 2026-10-10 18:24 ` Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2026-10-10 18:24 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
It missed to set the dso symtab type when the symbols are loaded by
libbfd. When it happens both syms_ss and runtime_ss may not be set
and won't call dso__load_sym().
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/symbol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 93045123cbbefdbd..5c2ba61ff8d9de51 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1935,6 +1935,7 @@ int dso__load(struct dso *dso, struct map *map)
symsrc__destroy(syms_ss);
syms_ss = NULL;
}
+ dso__set_symtab_type(dso, symtab_type);
ret = 1;
break;
}
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-10 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10 18:24 [PATCH v2 1/3] perf symbol: Fix symbol loading from libbfd Namhyung Kim
2026-10-10 18:24 ` [PATCH v2 2/3] perf symbol: Add missing symsrc__destroy() for libbfd Namhyung Kim
2026-10-10 18:24 ` [PATCH v2 3/3] perf symbol: Set dso symtab type " Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®