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 #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 */
40 /* Avoid "SyS" kernel syscall aliases */
41 if (strlen(sym
) >= 3 && !strncmp(sym
, "SyS", 3))
43 if (strlen(sym
) >= 10 && !strncmp(sym
, "compat_SyS", 10))
49 /* Allow matching against dot variants */
50 int arch__compare_symbol_names(const char *namea
, const char *nameb
)
52 /* Skip over initial dot */
58 return strcmp(namea
, nameb
);
62 #if defined(_CALL_ELF) && _CALL_ELF == 2
63 bool arch__prefers_symtab(void)
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
;