18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __PERF_SYMSRC_ 38c2ecf20Sopenharmony_ci#define __PERF_SYMSRC_ 1 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <stdbool.h> 68c2ecf20Sopenharmony_ci#include <stddef.h> 78c2ecf20Sopenharmony_ci#include "dso.h" 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifdef HAVE_LIBELF_SUPPORT 108c2ecf20Sopenharmony_ci#include <libelf.h> 118c2ecf20Sopenharmony_ci#include <gelf.h> 128c2ecf20Sopenharmony_ci#endif 138c2ecf20Sopenharmony_ci#include <elf.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct symsrc { 168c2ecf20Sopenharmony_ci char *name; 178c2ecf20Sopenharmony_ci int fd; 188c2ecf20Sopenharmony_ci enum dso_binary_type type; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#ifdef HAVE_LIBELF_SUPPORT 218c2ecf20Sopenharmony_ci Elf *elf; 228c2ecf20Sopenharmony_ci GElf_Ehdr ehdr; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci Elf_Scn *opdsec; 258c2ecf20Sopenharmony_ci size_t opdidx; 268c2ecf20Sopenharmony_ci GElf_Shdr opdshdr; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci Elf_Scn *symtab; 298c2ecf20Sopenharmony_ci GElf_Shdr symshdr; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci Elf_Scn *dynsym; 328c2ecf20Sopenharmony_ci size_t dynsym_idx; 338c2ecf20Sopenharmony_ci GElf_Shdr dynshdr; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci bool adjust_symbols; 368c2ecf20Sopenharmony_ci bool is_64_bit; 378c2ecf20Sopenharmony_ci#endif 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciint symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, enum dso_binary_type type); 418c2ecf20Sopenharmony_civoid symsrc__destroy(struct symsrc *ss); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cibool symsrc__has_symtab(struct symsrc *ss); 448c2ecf20Sopenharmony_cibool symsrc__possibly_runtime(struct symsrc *ss); 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#endif /* __PERF_SYMSRC_ */ 47