^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __PERF_SYMSRC_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __PERF_SYMSRC_ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include "dso.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifdef HAVE_LIBELF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <libelf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <gelf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct symsrc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int fd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum dso_binary_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #ifdef HAVE_LIBELF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Elf *elf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) GElf_Ehdr ehdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Elf_Scn *opdsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) size_t opdidx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) GElf_Shdr opdshdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Elf_Scn *symtab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) GElf_Shdr symshdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Elf_Scn *dynsym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) size_t dynsym_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) GElf_Shdr dynshdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) bool adjust_symbols;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) bool is_64_bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, enum dso_binary_type type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void symsrc__destroy(struct symsrc *ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) bool symsrc__has_symtab(struct symsrc *ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) bool symsrc__possibly_runtime(struct symsrc *ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif /* __PERF_SYMSRC_ */