Lines Matching refs:ElfW

66 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
68 static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count,
69 ElfW(Addr)* base, ElfW(Addr)* load_bias);
165 ElfW(Ehdr)* ehdr_vdso = reinterpret_cast<ElfW(Ehdr)*>(getauxval(AT_SYSINFO_EHDR)); in add_vdso()
172 si->phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff); in add_vdso()
174 si->base = reinterpret_cast<ElfW(Addr)>(ehdr_vdso); in add_vdso()
203 const ElfW(Phdr)* phdr;
205 ElfW(Addr) entry_point;
230 result.phdr = reinterpret_cast<const ElfW(Phdr)*>(getauxval(AT_PHDR)); in get_executable_info()
306 static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load) { in linker_main()
424 ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(si->base); in linker_main()
528 ElfW(Addr) entry = exe_info.entry_point; in linker_main()
543 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf) { in get_elf_exec_load_bias()
544 ElfW(Addr) offset = elf->e_phoff; in get_elf_exec_load_bias()
545 const ElfW(Phdr)* phdr_table = in get_elf_exec_load_bias() local
546 reinterpret_cast<const ElfW(Phdr)*>(reinterpret_cast<uintptr_t>(elf) + offset); in get_elf_exec_load_bias()
547 const ElfW(Phdr)* phdr_end = phdr_table + elf->e_phnum; in get_elf_exec_load_bias() local
549 for (const ElfW(Phdr)* phdr = phdr_table; phdr < phdr_end; phdr++) { in get_elf_exec_load_bias() local
551 return reinterpret_cast<ElfW(Addr)>(elf) + phdr->p_offset - phdr->p_vaddr; in get_elf_exec_load_bias()
562 static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count, in get_elf_base_from_phdr()
563 ElfW(Addr)* base, ElfW(Addr)* load_bias) { in get_elf_base_from_phdr()
566 *load_bias = reinterpret_cast<ElfW(Addr)>(phdr_table) - phdr_table[i].p_vaddr; in get_elf_base_from_phdr()
567 *base = reinterpret_cast<ElfW(Addr)>(phdr_table) - phdr_table[i].p_offset; in get_elf_base_from_phdr()
587 ElfW(Addr) seg_start = phdr->p_vaddr + si->load_bias; in set_bss_vma_name()
588 ElfW(Addr) seg_page_end = page_end(seg_start + phdr->p_memsz); in set_bss_vma_name()
589 ElfW(Addr) seg_file_end = page_end(seg_start + phdr->p_filesz); in set_bss_vma_name()
600 using RelType = ElfW(Rela);
604 using RelType = ElfW(Rel);
609 extern __LIBC_HIDDEN__ ElfW(Ehdr) __ehdr_start;
612 auto ehdr = reinterpret_cast<ElfW(Addr)>(&__ehdr_start); in call_ifunc_resolvers_for_section()
617 ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(ehdr + r->r_offset); in call_ifunc_resolvers_for_section()
619 ElfW(Addr) resolver = ehdr + r->r_addend; in call_ifunc_resolvers_for_section()
621 ElfW(Addr) resolver = ehdr + *offset; in call_ifunc_resolvers_for_section()
631 auto ehdr = reinterpret_cast<ElfW(Addr)>(&__ehdr_start); in relocate_linker()
632 auto* phdr = reinterpret_cast<ElfW(Phdr)*>(ehdr + __ehdr_start.e_phoff); in relocate_linker()
637 auto *dyn = reinterpret_cast<ElfW(Dyn)*>(ehdr + phdr[i].p_vaddr); in relocate_linker()
638 ElfW(Addr) relr = 0, relrsz = 0, pltrel = 0, pltrelsz = 0, rel = 0, relsz = 0; in relocate_linker()
639 for (size_t j = 0, size = phdr[i].p_filesz / sizeof(ElfW(Dyn)); j != size; ++j) { in relocate_linker()
662 relocate_relr(reinterpret_cast<ElfW(Relr*)>(ehdr + relr), in relocate_linker()
663 reinterpret_cast<ElfW(Relr*)>(ehdr + relr + relrsz), ehdr); in relocate_linker()
701 static ElfW(Addr) __attribute__((noinline))
713 extern "C" ElfW(Addr) __linker_init(void* raw_args) { in __linker_init()
729 ElfW(Addr) linker_addr = getauxval(AT_BASE); in __linker_init()
733 ElfW(Addr) load_bias; in __linker_init()
735 reinterpret_cast<ElfW(Phdr)*>(getauxval(AT_PHDR)), getauxval(AT_PHNUM), in __linker_init()
739 ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr); in __linker_init()
740 ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_addr + elf_hdr->e_phoff); in __linker_init()
771 static ElfW(Addr) __attribute__((noinline))
795 for (const ElfW(Dyn)* d = tmp_linker_so.dynamic; d->d_tag != DT_NULL; ++d) { in __linker_init_post_relocation() local
844 ElfW(Addr) start_address = linker_main(args, exe_to_load); in __linker_init_post_relocation()