ARM: dts: kirkwood: gpio-leds fixes for linkstation ls-wvl/vl
[linux/fpc-iii.git] / tools / perf / arch / powerpc / util / sym-handling.c
blobbbc1a50768dd5de5183f1890a806f710545bf28e
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
6 * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
7 */
9 #include "debug.h"
10 #include "symbol.h"
11 #include "map.h"
12 #include "probe-event.h"
14 #ifdef HAVE_LIBELF_SUPPORT
15 bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
17 return ehdr.e_type == ET_EXEC ||
18 ehdr.e_type == ET_REL ||
19 ehdr.e_type == ET_DYN;
22 #if defined(_CALL_ELF) && _CALL_ELF == 2
23 void arch__elf_sym_adjust(GElf_Sym *sym)
25 sym->st_value += PPC64_LOCAL_ENTRY_OFFSET(sym->st_other);
27 #endif
28 #endif
30 #if !defined(_CALL_ELF) || _CALL_ELF != 2
31 int arch__choose_best_symbol(struct symbol *syma,
32 struct symbol *symb __maybe_unused)
34 char *sym = syma->name;
36 /* Skip over any initial dot */
37 if (*sym == '.')
38 sym++;
40 /* Avoid "SyS" kernel syscall aliases */
41 if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3))
42 return SYMBOL_B;
43 if (strlen(sym) >= 10 && !strncmp(sym, "compat_SyS", 10))
44 return SYMBOL_B;
46 return SYMBOL_A;
49 /* Allow matching against dot variants */
50 int arch__compare_symbol_names(const char *namea, const char *nameb)
52 /* Skip over initial dot */
53 if (*namea == '.')
54 namea++;
55 if (*nameb == '.')
56 nameb++;
58 return strcmp(namea, nameb);
60 #endif
62 #if defined(_CALL_ELF) && _CALL_ELF == 2
63 bool arch__prefers_symtab(void)
65 return true;
68 #define PPC64LE_LEP_OFFSET 8
70 void arch__fix_tev_from_maps(struct perf_probe_event *pev,
71 struct probe_trace_event *tev, struct map *map)
74 * ppc64 ABIv2 local entry point is currently always 2 instructions
75 * (8 bytes) after the global entry point.
77 if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
78 tev->point.address += PPC64LE_LEP_OFFSET;
79 tev->point.offset += PPC64LE_LEP_OFFSET;
82 #endif