Lines Matching refs:lte
243 arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela *rela)
245 if (lte->ehdr.e_machine == EM_PPC && lte->arch.secure_plt) {
246 assert(lte->arch.plt_stub_vma != 0);
247 return lte->arch.plt_stub_vma + PPC_PLT_STUB_SIZE * ndx;
249 } else if (lte->ehdr.e_machine == EM_PPC) {
255 } else if (reloc_is_irelative(lte->ehdr.e_machine, rela)) {
263 if (arch_translate_address(lte, res_addr, &res_addr) < 0) {
274 assert(lte->arch.plt_stub_vma != 0);
275 return lte->arch.plt_stub_vma + PPC64_PLT_STUB_SIZE * ndx;
306 arch_translate_address(struct ltelf *lte,
309 if (lte->ehdr.e_machine == EM_PPC64) {
313 = (GElf_Addr)(uintptr_t)addr - lte->arch.opd_base;
315 if (elf_read_u64(lte->arch.opd_data, offset, &value) < 0) {
320 *ret = (arch_addr_t)(uintptr_t)(value + lte->bias);
329 load_opd_data(struct ltelf *lte, struct library *lib)
333 if (elf_get_section_named(lte, ".opd", &sec, &shdr) < 0
340 lte->arch.opd_data = elf_rawdata(sec, NULL);
341 if (lte->arch.opd_data == NULL)
344 lte->arch.opd_base = shdr.sh_addr + lte->bias;
345 lte->arch.opd_size = shdr.sh_size;
357 get_glink_vma(struct ltelf *lte, GElf_Addr ppcgot, Elf_Data *plt_data)
362 && (elf_get_section_covering(lte, ppcgot,
424 struct ltelf *lte = data;
426 return CBS_STOP_IF(reloc_is_irelative(lte->ehdr.e_machine, rela)
427 && VECT_PUSHBACK(<e->plt_relocs, rela) < 0);
431 arch_elf_init(struct ltelf *lte, struct library *lib)
433 if (lte->ehdr.e_machine == EM_PPC64
434 && load_opd_data(lte, lib) < 0)
437 lte->arch.secure_plt = !(lte->plt_flags & SHF_EXECINSTR);
443 if (lte->ehdr.e_machine == EM_PPC && !lte->arch.secure_plt)
444 lib->arch.bss_plt_prelinked = nonzero_data(lte->plt_data);
453 * .rela.plt. Add these to lte->plt_relocs. */
458 if ((lte->ehdr.e_machine == EM_PPC64 || lte->arch.secure_plt)
459 && elf_load_dynamic_entry(lte, DT_RELA, &rela) == 0
460 && elf_load_dynamic_entry(lte, DT_RELASZ, &relasz) == 0
461 && elf_get_section_covering(lte, rela, &rela_sec, &rela_shdr) == 0
466 int ret = elf_read_relocs(lte, rela_sec, &rela_shdr, &v);
469 reloc_copy_if_irelative, lte) != NULL)
478 if (lte->ehdr.e_machine == EM_PPC && lte->arch.secure_plt) {
480 if (elf_load_dynamic_entry(lte, DT_PPC_GOT, &ppcgot) < 0) {
484 GElf_Addr glink_vma = get_glink_vma(lte, ppcgot, lte->plt_data);
486 size_t count = vect_size(<e->plt_relocs);
487 lte->arch.plt_stub_vma = glink_vma
489 debug(1, "stub_vma is %#" PRIx64, lte->arch.plt_stub_vma);
491 } else if (lte->ehdr.e_machine == EM_PPC64) {
493 if (elf_load_dynamic_entry(lte, DT_PPC64_GLINK,
500 lte->arch.plt_stub_vma = glink_vma + 32;
504 if (elf_load_dynamic_entry(lte, DT_PLTGOT,
513 if (lte->ehdr.e_machine == EM_PPC64
514 && lte->symtab != NULL && lte->strtab != NULL) {
527 for (i = 0; i < lte->symtab_count; ++i) {
529 if (gelf_getsym(lte->symtab, i, &sym) == NULL) {
532 for (sym = lte->arch.stubs; sym != NULL; ) {
538 lte->arch.stubs = NULL;
542 const char *name = lte->strtab + sym.st_name;
579 (uintptr_t)sym.st_value + lte->bias;
584 libsym->next = lte->arch.stubs;
585 lte->arch.stubs = libsym;
627 arch_elf_add_func_entry(struct process *proc, struct ltelf *lte,
632 if (lte->ehdr.e_machine != EM_PPC || lte->ehdr.e_type == ET_DYN)
642 size_t len = vect_size(<e->plt_relocs);
645 GElf_Rela *rela = VECT_ELEMENT(<e->plt_relocs, GElf_Rela, i);
646 if (sym->st_value == arch_plt_sym_val(lte, i, rela)) {
665 if (elf_add_plt_entry(proc, lte, name, rela,
691 arch_elf_add_plt_entry(struct process *proc, struct ltelf *lte,
695 bool is_irelative = reloc_is_irelative(lte->ehdr.e_machine, rela);
700 GElf_Addr addr = lte->ehdr.e_machine == EM_PPC64
702 : arch_plt_sym_val(lte, ndx, rela);
703 name = linux_elf_find_irelative_name(lte, addr);
713 if (lte->ehdr.e_machine == EM_PPC) {
714 if (default_elf_add_plt_entry(proc, lte, name, rela, ndx,
718 if (! lte->arch.secure_plt) {
735 for (symp = <e->arch.stubs; *symp != NULL; ) {
758 GElf_Addr plt_entry_addr = arch_plt_sym_val(lte, ndx, rela);
761 assert(plt_slot_addr >= lte->plt_addr
762 || plt_slot_addr < lte->plt_addr + lte->plt_size);
813 arch_elf_destroy(struct ltelf *lte)
816 for (sym = lte->arch.stubs; sym != NULL; ) {