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
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);
30 int arch__choose_best_symbol(struct symbol *syma,
31 struct symbol *symb __maybe_unused)
33 char *sym = syma->name;
35 #if !defined(_CALL_ELF) || _CALL_ELF != 2
36 /* Skip over any initial dot */
41 /* Avoid "SyS" kernel syscall aliases */
42 if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3))
44 if (strlen(sym) >= 10 && !strncmp(sym, "compat_SyS", 10))
50 #if !defined(_CALL_ELF) || _CALL_ELF != 2
51 /* Allow matching against dot variants */
52 int arch__compare_symbol_names(const char *namea, const char *nameb)
54 /* Skip over initial dot */
60 return strcmp(namea, nameb);
64 #if defined(_CALL_ELF) && _CALL_ELF == 2
65 bool arch__prefers_symtab(void)
70 #define PPC64LE_LEP_OFFSET 8
72 void arch__fix_tev_from_maps(struct perf_probe_event *pev,
73 struct probe_trace_event *tev, struct map *map)
76 * ppc64 ABIv2 local entry point is currently always 2 instructions
77 * (8 bytes) after the global entry point.
79 if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
80 tev->point.address += PPC64LE_LEP_OFFSET;
81 tev->point.offset += PPC64LE_LEP_OFFSET;