Lines Matching refs:ElfW

84 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
418 static ElfW(Sym)* soinfo_elf_lookup(soinfo* si, unsigned hash, const char* name) { in ElfW() function
419 ElfW(Sym)* symtab = si->symtab; in ElfW()
425 ElfW(Sym)* s = symtab + n; in ElfW()
482 static ElfW(Sym)* soinfo_do_lookup(soinfo* si, const char* name, soinfo** lsi) { in ElfW() function
484 ElfW(Sym)* s = nullptr; in ElfW()
646 ElfW(Sym)* dlsym_handle_lookup(soinfo* si, soinfo** found, const char* name) { in ElfW() function
657 ElfW(Sym)* result = soinfo_elf_lookup(current_soinfo, elfhash(name), name); in ElfW()
678 ElfW(Sym)* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start) { in ElfW() function
685 ElfW(Sym)* s = nullptr; in ElfW()
703 ElfW(Addr) address = reinterpret_cast<ElfW(Addr)>(p); in find_containing_library()
712 ElfW(Sym)* dladdr_find_symbol(soinfo* si, const void* addr) { in ElfW() function
713 ElfW(Addr) soaddr = reinterpret_cast<ElfW(Addr)>(addr) - si->base; in ElfW()
718 ElfW(Sym)* sym = &si->symtab[i]; in ElfW()
770 for (ElfW(Dyn)* d = si->dynamic; d->d_tag != DT_NULL; ++d) { in for_each_dt_needed()
1072 static ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr) { in call_ifunc_resolver()
1073 typedef ElfW(Addr) (*ifunc_resolver_t)(void); in call_ifunc_resolver()
1075 ElfW(Addr) ifunc_addr = ifunc_resolver(); in call_ifunc_resolver()
1082 int soinfo::Relocate(ElfW(Rela)* rela, unsigned count) { in Relocate()
1086 ElfW(Addr) reloc = static_cast<ElfW(Addr)>(rela->r_offset + load_bias); in Relocate()
1087 ElfW(Addr) sym_addr = 0; in Relocate()
1095 ElfW(Sym)* s = nullptr; in Relocate()
1167 *reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + rela->r_addend); in Relocate()
1174 *reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + rela->r_addend); in Relocate()
1181 *reinterpret_cast<ElfW(Addr)*>(reloc) += (sym_addr + rela->r_addend); in Relocate()
1188 …if ((static_cast<ElfW(Addr)>(INT32_MIN) <= (*reinterpret_cast<ElfW(Addr)*>(reloc) + (sym_addr + re… in Relocate()
1189 …((*reinterpret_cast<ElfW(Addr)*>(reloc) + (sym_addr + rela->r_addend)) <= static_cast<ElfW(Addr)>(… in Relocate()
1190 *reinterpret_cast<ElfW(Addr)*>(reloc) += (sym_addr + rela->r_addend); in Relocate()
1193 (*reinterpret_cast<ElfW(Addr)*>(reloc) + (sym_addr + rela->r_addend)), in Relocate()
1194 static_cast<ElfW(Addr)>(INT32_MIN), in Relocate()
1195 static_cast<ElfW(Addr)>(UINT32_MAX)); in Relocate()
1204 …if ((static_cast<ElfW(Addr)>(INT16_MIN) <= (*reinterpret_cast<ElfW(Addr)*>(reloc) + (sym_addr + re… in Relocate()
1205 …((*reinterpret_cast<ElfW(Addr)*>(reloc) + (sym_addr + rela->r_addend)) <= static_cast<ElfW(Addr)>(… in Relocate()
1206 *reinterpret_cast<ElfW(Addr)*>(reloc) += (sym_addr + rela->r_addend); in Relocate()
1209 (*reinterpret_cast<ElfW(Addr)*>(reloc) + (sym_addr + rela->r_addend)), in Relocate()
1210 static_cast<ElfW(Addr)>(INT16_MIN), in Relocate()
1211 static_cast<ElfW(Addr)>(UINT16_MAX)); in Relocate()
1220 *reinterpret_cast<ElfW(Addr)*>(reloc) += (sym_addr + rela->r_addend) - rela->r_offset; in Relocate()
1227 …if ((static_cast<ElfW(Addr)>(INT32_MIN) <= (*reinterpret_cast<ElfW(Addr)*>(reloc) + ((sym_addr + r… in Relocate()
1228 …((*reinterpret_cast<ElfW(Addr)*>(reloc) + ((sym_addr + rela->r_addend) - rela->r_offset)) <= stati… in Relocate()
1229 *reinterpret_cast<ElfW(Addr)*>(reloc) += ((sym_addr + rela->r_addend) - rela->r_offset); in Relocate()
1232 … (*reinterpret_cast<ElfW(Addr)*>(reloc) + ((sym_addr + rela->r_addend) - rela->r_offset)), in Relocate()
1233 static_cast<ElfW(Addr)>(INT32_MIN), in Relocate()
1234 static_cast<ElfW(Addr)>(UINT32_MAX)); in Relocate()
1243 …if ((static_cast<ElfW(Addr)>(INT16_MIN) <= (*reinterpret_cast<ElfW(Addr)*>(reloc) + ((sym_addr + r… in Relocate()
1244 …((*reinterpret_cast<ElfW(Addr)*>(reloc) + ((sym_addr + rela->r_addend) - rela->r_offset)) <= stati… in Relocate()
1245 *reinterpret_cast<ElfW(Addr)*>(reloc) += ((sym_addr + rela->r_addend) - rela->r_offset); in Relocate()
1248 … (*reinterpret_cast<ElfW(Addr)*>(reloc) + ((sym_addr + rela->r_addend) - rela->r_offset)), in Relocate()
1249 static_cast<ElfW(Addr)>(INT16_MIN), in Relocate()
1250 static_cast<ElfW(Addr)>(UINT16_MAX)); in Relocate()
1264 *reinterpret_cast<ElfW(Addr)*>(reloc) = (base + rela->r_addend); in Relocate()
1271 *reinterpret_cast<ElfW(Addr)*>(reloc) = call_ifunc_resolver(base + rela->r_addend); in Relocate()
1300 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + rela->r_addend; in Relocate()
1307 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + rela->r_addend; in Relocate()
1318 *reinterpret_cast<ElfW(Addr)*>(reloc) = base + rela->r_addend; in Relocate()
1324 *reinterpret_cast<ElfW(Addr)*>(reloc) = call_ifunc_resolver(base + rela->r_addend); in Relocate()
1331 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + rela->r_addend; in Relocate()
1338 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + rela->r_addend; in Relocate()
1346 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + rela->r_addend - reloc; in Relocate()
1359 int soinfo::Relocate(ElfW(Rel)* rel, unsigned count) { in Relocate()
1364 ElfW(Addr) reloc = static_cast<ElfW(Addr)>(rel->r_offset + load_bias); in Relocate()
1365 ElfW(Addr) sym_addr = 0; in Relocate()
1373 ElfW(Sym)* s = nullptr; in Relocate()
1446 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr; in Relocate()
1452 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr; in Relocate()
1458 *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr; in Relocate()
1465 *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr - rel->r_offset; in Relocate()
1484 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr; in Relocate()
1490 *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr; in Relocate()
1496 *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr; in Relocate()
1503 *reinterpret_cast<ElfW(Addr)*>(reloc) += (sym_addr - reloc); in Relocate()
1523 *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr; in Relocate()
1525 *reinterpret_cast<ElfW(Addr)*>(reloc) += base; in Relocate()
1543 *reinterpret_cast<ElfW(Addr)*>(reloc) += base; in Relocate()
1550 …*reinterpret_cast<ElfW(Addr)*>(reloc) = call_ifunc_resolver(base + *reinterpret_cast<ElfW(Addr)*>(… in Relocate()
1565 ElfW(Addr)** got = si->plt_got; in mips_relocate_got()
1572 ElfW(Sym)* symtab = si->symtab; in mips_relocate_got()
1580 got[g++] = reinterpret_cast<ElfW(Addr)*>(0xdeadbeef); in mips_relocate_got()
1582 got[g++] = reinterpret_cast<ElfW(Addr)*>(0xdeadfeed); in mips_relocate_got()
1586 got[g] = reinterpret_cast<ElfW(Addr)*>(reinterpret_cast<uintptr_t>(got[g]) + si->load_bias); in mips_relocate_got()
1591 ElfW(Sym)* sym = symtab + gotsym; in mips_relocate_got()
1597 ElfW(Sym)* s = soinfo_do_lookup(si, sym_name, &lsi); in mips_relocate_got()
1610 *got = reinterpret_cast<ElfW(Addr)*>(lsi->resolve_symbol_address(s)); in mips_relocate_got()
1781 ElfW(Addr) soinfo::resolve_symbol_address(ElfW(Sym)* s) { in ElfW() function
1786 return static_cast<ElfW(Addr)>(s->st_value + load_bias); in ElfW()
1789 const char* soinfo::get_string(ElfW(Word) index) const { in get_string()
1860 ElfW(Word) dynamic_flags = 0; in PrelinkImage()
1888 for (ElfW(Dyn)* d = dynamic; d->d_tag != DT_NULL; ++d) { in PrelinkImage()
1913 symtab = reinterpret_cast<ElfW(Sym)*>(load_bias + d->d_un.d_ptr); in PrelinkImage()
1917 if (d->d_un.d_val != sizeof(ElfW(Sym))) { in PrelinkImage()
1939 plt_rela = reinterpret_cast<ElfW(Rela)*>(load_bias + d->d_un.d_ptr); in PrelinkImage()
1941 plt_rel = reinterpret_cast<ElfW(Rel)*>(load_bias + d->d_un.d_ptr); in PrelinkImage()
1947 plt_rela_count = d->d_un.d_val / sizeof(ElfW(Rela)); in PrelinkImage()
1949 plt_rel_count = d->d_un.d_val / sizeof(ElfW(Rel)); in PrelinkImage()
1956 plt_got = reinterpret_cast<ElfW(Addr)**>(load_bias + d->d_un.d_ptr); in PrelinkImage()
1976 rela = reinterpret_cast<ElfW(Rela)*>(load_bias + d->d_un.d_ptr); in PrelinkImage()
1980 rela_count = d->d_un.d_val / sizeof(ElfW(Rela)); in PrelinkImage()
1984 if (d->d_un.d_val != sizeof(ElfW(Rela))) { in PrelinkImage()
2003 rel = reinterpret_cast<ElfW(Rel)*>(load_bias + d->d_un.d_ptr); in PrelinkImage()
2007 rel_count = d->d_un.d_val / sizeof(ElfW(Rel)); in PrelinkImage()
2011 if (d->d_un.d_val != sizeof(ElfW(Rel))) { in PrelinkImage()
2044 init_array_count = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr)); in PrelinkImage()
2053 fini_array_count = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr)); in PrelinkImage()
2062 preinit_array_count = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr)); in PrelinkImage()
2273 ElfW(Ehdr)* ehdr_vdso = reinterpret_cast<ElfW(Ehdr)*>(args.getauxval(AT_SYSINFO_EHDR)); in add_vdso()
2280 si->phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff); in add_vdso()
2282 si->base = reinterpret_cast<ElfW(Addr)>(ehdr_vdso); in add_vdso()
2308 static void init_linker_info_for_gdb(ElfW(Addr) linker_base) { in init_linker_info_for_gdb()
2317 ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_base); in init_linker_info_for_gdb()
2318 ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_base + elf_hdr->e_phoff); in init_linker_info_for_gdb()
2329 static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(Addr) linker_base) {
2383 si->phdr = reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR));
2396 si->load_bias = reinterpret_cast<ElfW(Addr)>(si->phdr) - si->phdr[i].p_vaddr;
2397 si->base = reinterpret_cast<ElfW(Addr)>(si->phdr) - si->phdr[i].p_offset;
2404 ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(si->base);
2522 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf) {
2523 ElfW(Addr) offset = elf->e_phoff;
2524 …const ElfW(Phdr)* phdr_table = reinterpret_cast<const ElfW(Phdr)*>(reinterpret_cast<uintptr_t>(elf… local
2525 const ElfW(Phdr)* phdr_end = phdr_table + elf->e_phnum; local
2527 for (const ElfW(Phdr)* phdr = phdr_table; phdr < phdr_end; phdr++) { local
2529 return reinterpret_cast<ElfW(Addr)>(elf) + phdr->p_offset - phdr->p_vaddr;
2546 extern "C" ElfW(Addr) __linker_init(void* raw_args) {
2549 ElfW(Addr) linker_addr = args.getauxval(AT_BASE);
2550 ElfW(Addr) entry_point = args.getauxval(AT_ENTRY);
2551 ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);
2552 ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_addr + elf_hdr->e_phoff);
2562 if (reinterpret_cast<ElfW(Addr)>(&_start) == entry_point) {
2600 ElfW(Addr) start_address = __linker_init_post_relocation(args, linker_addr);