Skip to content

Commit fb6d594

Browse files
rnavacmel
authored andcommitted
perf probe ppc: Use the right prefix when ignoring SyS symbols on ppc
Use the proper prefix when ignoring SyS symbols on ppc ABIv1. While at it, generalize symbol selection so architectures can implement their own logic. Signed-off-by: Naveen N. Rao <[email protected]> Reviewed-by: Srikar Dronamraju <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Sukadev Bhattiprolu <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/adf1f98b121ecaf292777fe5cc69fe1038feabce.1430217967.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent d233209 commit fb6d594

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

tools/perf/arch/powerpc/util/sym-handling.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,23 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
1717
ehdr.e_type == ET_DYN;
1818
}
1919
#endif
20+
21+
#if !defined(_CALL_ELF) || _CALL_ELF != 2
22+
int arch__choose_best_symbol(struct symbol *syma,
23+
struct symbol *symb __maybe_unused)
24+
{
25+
char *sym = syma->name;
26+
27+
/* Skip over any initial dot */
28+
if (*sym == '.')
29+
sym++;
30+
31+
/* Avoid "SyS" kernel syscall aliases */
32+
if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3))
33+
return SYMBOL_B;
34+
if (strlen(sym) >= 10 && !strncmp(sym, "compat_SyS", 10))
35+
return SYMBOL_B;
36+
37+
return SYMBOL_A;
38+
}
39+
#endif

tools/perf/util/symbol.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,17 @@ static int prefix_underscores_count(const char *str)
8585
return tail - str;
8686
}
8787

88-
#define SYMBOL_A 0
89-
#define SYMBOL_B 1
88+
int __weak arch__choose_best_symbol(struct symbol *syma,
89+
struct symbol *symb __maybe_unused)
90+
{
91+
/* Avoid "SyS" kernel syscall aliases */
92+
if (strlen(syma->name) >= 3 && !strncmp(syma->name, "SyS", 3))
93+
return SYMBOL_B;
94+
if (strlen(syma->name) >= 10 && !strncmp(syma->name, "compat_SyS", 10))
95+
return SYMBOL_B;
96+
97+
return SYMBOL_A;
98+
}
9099

91100
static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
92101
{
@@ -134,13 +143,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
134143
else if (na < nb)
135144
return SYMBOL_B;
136145

137-
/* Avoid "SyS" kernel syscall aliases */
138-
if (na >= 3 && !strncmp(syma->name, "SyS", 3))
139-
return SYMBOL_B;
140-
if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10))
141-
return SYMBOL_B;
142-
143-
return SYMBOL_A;
146+
return arch__choose_best_symbol(syma, symb);
144147
}
145148

146149
void symbols__fixup_duplicate(struct rb_root *symbols)

tools/perf/util/symbol.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,9 @@ int setup_intlist(struct intlist **list, const char *list_str,
307307
bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
308308
#endif
309309

310+
#define SYMBOL_A 0
311+
#define SYMBOL_B 1
312+
313+
int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb);
314+
310315
#endif /* __PERF_SYMBOL */

0 commit comments

Comments
 (0)