Lines Matching defs:sym
109 * @sym: GElf_Sym iterator
111 #define elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) \
112 for (idx = 0, gelf_getsym(syms, idx, &sym);\
114 idx++, gelf_getsym(syms, idx, &sym))
116 static inline uint8_t elf_sym__type(const GElf_Sym *sym)
118 return GELF_ST_TYPE(sym->st_info);
121 static inline uint8_t elf_sym__visibility(const GElf_Sym *sym)
123 return GELF_ST_VISIBILITY(sym->st_other);
130 static inline int elf_sym__is_function(const GElf_Sym *sym)
132 return (elf_sym__type(sym) == STT_FUNC ||
133 elf_sym__type(sym) == STT_GNU_IFUNC) &&
134 sym->st_name != 0 &&
135 sym->st_shndx != SHN_UNDEF;
138 static inline bool elf_sym__is_object(const GElf_Sym *sym)
140 return elf_sym__type(sym) == STT_OBJECT &&
141 sym->st_name != 0 &&
142 sym->st_shndx != SHN_UNDEF;
145 static inline int elf_sym__is_label(const GElf_Sym *sym)
147 return elf_sym__type(sym) == STT_NOTYPE &&
148 sym->st_name != 0 &&
149 sym->st_shndx != SHN_UNDEF &&
150 sym->st_shndx != SHN_ABS &&
151 elf_sym__visibility(sym) != STV_HIDDEN &&
152 elf_sym__visibility(sym) != STV_INTERNAL;
155 static bool elf_sym__filter(GElf_Sym *sym)
157 return elf_sym__is_function(sym) || elf_sym__is_object(sym);
160 static inline const char *elf_sym__name(const GElf_Sym *sym,
163 return symstrs->d_buf + sym->st_name;
313 GElf_Sym sym;
417 gelf_getsym(syms, symidx, &sym);
419 elf_name = elf_sym__name(&sym, symstrs);
443 gelf_getsym(syms, symidx, &sym);
445 elf_name = elf_sym__name(&sym, symstrs);
957 GElf_Sym *sym __maybe_unused) { }
960 GElf_Sym *sym, GElf_Shdr *shdr,
972 sym->st_value -= shdr->sh_addr - shdr->sh_offset;
1021 u64 start = sym->st_value;
1081 GElf_Sym sym;
1148 memset(&sym, 0, sizeof(sym));
1155 elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
1156 const char *elf_name = elf_sym__name(&sym, symstrs);
1160 kmap->ref_reloc_sym->unrelocated_addr = sym.st_value;
1183 elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
1185 const char *elf_name = elf_sym__name(&sym, symstrs);
1187 int is_label = elf_sym__is_label(&sym);
1191 if (!is_label && !elf_sym__filter(&sym))
1203 if (runtime_ss->opdsec && sym.st_shndx == runtime_ss->opdidx) {
1204 u32 offset = sym.st_value - syms_ss->opdshdr.sh_addr;
1206 sym.st_value = DSO__SWAP(dso, u64, *opd);
1207 sym.st_shndx = elf_addr_to_index(runtime_ss->elf,
1208 sym.st_value);
1221 if (sym.st_shndx == SHN_ABS)
1224 sec = elf_getscn(runtime_ss->elf, sym.st_shndx);
1238 (GELF_ST_TYPE(sym.st_info) == STT_FUNC) &&
1239 (sym.st_value & 1))
1240 --sym.st_value;
1243 if (dso__process_kernel_symbol(dso, map, &sym, &shdr, kmaps, kmap, &curr_dso, &curr_map,
1251 (u64)sym.st_value, &phdr)) {
1254 __func__, elf_name, (u64)sym.st_value);
1257 __func__, (u64)sym.st_value, (u64)shdr.sh_addr,
1267 sym.st_value -= shdr.sh_addr - shdr.sh_offset;
1271 __func__, (u64)sym.st_value, (u64)phdr.p_vaddr,
1273 sym.st_value -= phdr.p_vaddr - phdr.p_offset;
1281 f = symbol__new(sym.st_value, sym.st_size,
1282 GELF_ST_BIND(sym.st_info),
1283 GELF_ST_TYPE(sym.st_info), elf_name);
1288 arch__sym_update(f, &sym);