Skip to content

Commit 838425f

Browse files
namhyungacmel
authored andcommitted
perf symbol: Pass is_kallsyms to symbols__fixup_end()
The symbol fixup is necessary for symbols in kallsyms since they don't have size info. So we use the next symbol's address to calculate the size. Now it's also used for user binaries because sometimes they miss size for hand-written asm functions. There's a arch-specific function to handle kallsyms differently but currently it cannot distinguish kallsyms from others. Pass this information explicitly to handle it properly. Note that those arch functions will be moved to the generic function so I didn't added it to the arch-functions. Fixes: 3cf6a32 ("perf symbols: Fix symbol size calculation condition") Signed-off-by: Namhyung Kim <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 3b9a8c8 commit 838425f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

tools/perf/util/symbol-elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
12901290
* For misannotated, zeroed, ASM function sizes.
12911291
*/
12921292
if (nr > 0) {
1293-
symbols__fixup_end(&dso->symbols);
1293+
symbols__fixup_end(&dso->symbols, false);
12941294
symbols__fixup_duplicate(&dso->symbols);
12951295
if (kmap) {
12961296
/*

tools/perf/util/symbol.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ void symbols__fixup_duplicate(struct rb_root_cached *symbols)
217217
}
218218
}
219219

220-
void symbols__fixup_end(struct rb_root_cached *symbols)
220+
void symbols__fixup_end(struct rb_root_cached *symbols,
221+
bool is_kallsyms __maybe_unused)
221222
{
222223
struct rb_node *nd, *prevnd = rb_first_cached(symbols);
223224
struct symbol *curr, *prev;
@@ -1467,7 +1468,7 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename,
14671468
if (kallsyms__delta(kmap, filename, &delta))
14681469
return -1;
14691470

1470-
symbols__fixup_end(&dso->symbols);
1471+
symbols__fixup_end(&dso->symbols, true);
14711472
symbols__fixup_duplicate(&dso->symbols);
14721473

14731474
if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
@@ -1659,7 +1660,7 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
16591660
#undef bfd_asymbol_section
16601661
#endif
16611662

1662-
symbols__fixup_end(&dso->symbols);
1663+
symbols__fixup_end(&dso->symbols, false);
16631664
symbols__fixup_duplicate(&dso->symbols);
16641665
dso->adjust_symbols = 1;
16651666

tools/perf/util/symbol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void __symbols__insert(struct rb_root_cached *symbols, struct symbol *sym,
203203
bool kernel);
204204
void symbols__insert(struct rb_root_cached *symbols, struct symbol *sym);
205205
void symbols__fixup_duplicate(struct rb_root_cached *symbols);
206-
void symbols__fixup_end(struct rb_root_cached *symbols);
206+
void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kallsyms);
207207
void maps__fixup_end(struct maps *maps);
208208

209209
typedef int (*mapfn_t)(u64 start, u64 len, u64 pgoff, void *data);

0 commit comments

Comments
 (0)