Commit fb6d5942 authored by Naveen N. Rao's avatar Naveen N. Rao Committed by Arnaldo Carvalho de Melo

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: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/adf1f98b121ecaf292777fe5cc69fe1038feabce.1430217967.git.naveen.n.rao@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d2332098
...@@ -17,3 +17,23 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) ...@@ -17,3 +17,23 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
ehdr.e_type == ET_DYN; ehdr.e_type == ET_DYN;
} }
#endif #endif
#if !defined(_CALL_ELF) || _CALL_ELF != 2
int arch__choose_best_symbol(struct symbol *syma,
struct symbol *symb __maybe_unused)
{
char *sym = syma->name;
/* Skip over any initial dot */
if (*sym == '.')
sym++;
/* Avoid "SyS" kernel syscall aliases */
if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3))
return SYMBOL_B;
if (strlen(sym) >= 10 && !strncmp(sym, "compat_SyS", 10))
return SYMBOL_B;
return SYMBOL_A;
}
#endif
...@@ -85,8 +85,17 @@ static int prefix_underscores_count(const char *str) ...@@ -85,8 +85,17 @@ static int prefix_underscores_count(const char *str)
return tail - str; return tail - str;
} }
#define SYMBOL_A 0 int __weak arch__choose_best_symbol(struct symbol *syma,
#define SYMBOL_B 1 struct symbol *symb __maybe_unused)
{
/* Avoid "SyS" kernel syscall aliases */
if (strlen(syma->name) >= 3 && !strncmp(syma->name, "SyS", 3))
return SYMBOL_B;
if (strlen(syma->name) >= 10 && !strncmp(syma->name, "compat_SyS", 10))
return SYMBOL_B;
return SYMBOL_A;
}
static int choose_best_symbol(struct symbol *syma, struct symbol *symb) static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
{ {
...@@ -134,13 +143,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb) ...@@ -134,13 +143,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
else if (na < nb) else if (na < nb)
return SYMBOL_B; return SYMBOL_B;
/* Avoid "SyS" kernel syscall aliases */ return arch__choose_best_symbol(syma, symb);
if (na >= 3 && !strncmp(syma->name, "SyS", 3))
return SYMBOL_B;
if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10))
return SYMBOL_B;
return SYMBOL_A;
} }
void symbols__fixup_duplicate(struct rb_root *symbols) void symbols__fixup_duplicate(struct rb_root *symbols)
......
...@@ -307,4 +307,9 @@ int setup_intlist(struct intlist **list, const char *list_str, ...@@ -307,4 +307,9 @@ int setup_intlist(struct intlist **list, const char *list_str,
bool elf__needs_adjust_symbols(GElf_Ehdr ehdr); bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
#endif #endif
#define SYMBOL_A 0
#define SYMBOL_B 1
int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb);
#endif /* __PERF_SYMBOL */ #endif /* __PERF_SYMBOL */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment