diff options
Diffstat (limited to 'elf.c')
-rw-r--r-- | elf.c | 64 |
1 files changed, 32 insertions, 32 deletions
@@ -176,15 +176,15 @@ static void do_init_elf(struct ltelf *lte, const char *filename) table. */ - if(dyn.d_tag==DT_PLTGOT){ - lte->pltgot_addr=dyn.d_un.d_ptr; - } - if(dyn.d_tag==DT_MIPS_LOCAL_GOTNO){ - lte->mips_local_gotno=dyn.d_un.d_val; - } - if(dyn.d_tag==DT_MIPS_GOTSYM){ - lte->mips_gotsym=dyn.d_un.d_val; - } + if(dyn.d_tag==DT_PLTGOT){ + lte->pltgot_addr=dyn.d_un.d_ptr; + } + if(dyn.d_tag==DT_MIPS_LOCAL_GOTNO){ + lte->mips_local_gotno=dyn.d_un.d_val; + } + if(dyn.d_tag==DT_MIPS_GOTSYM){ + lte->mips_gotsym=dyn.d_un.d_val; + } #endif // __mips__ if (dyn.d_tag == DT_JMPREL) relplt_addr = dyn.d_un.d_ptr; @@ -469,28 +469,28 @@ struct library_symbol *read_elf(struct process *proc) for (i = 0; i < library_num; ++i) do_init_elf(<e[i + 1], library[i]); #ifdef __mips__ - // MIPS doesn't use the PLT and the GOT entries get changed - // on startup. - proc->need_to_reinitialize_breakpoints = 1; - for(i=lte->mips_gotsym; i<lte->dynsym_count;i++){ - GElf_Sym sym; - const char *name; - GElf_Addr addr = arch_plt_sym_val(lte, i, 0); - if (gelf_getsym(lte->dynsym, i, &sym) == NULL){ - error(EXIT_FAILURE, 0, - "Couldn't get relocation from \"%s\"", - proc->filename); - } - name=lte->dynstr+sym.st_name; - if(ELF64_ST_TYPE(sym.st_info) != STT_FUNC){ - debug(2,"sym %s not a function",name); - continue; - } - add_library_symbol(addr, name, &library_symbols, 0, - ELF64_ST_BIND(sym.st_info) != 0); - if (!lib_tail) - lib_tail = &(library_symbols->next); - } + // MIPS doesn't use the PLT and the GOT entries get changed + // on startup. + proc->need_to_reinitialize_breakpoints = 1; + for(i=lte->mips_gotsym; i<lte->dynsym_count;i++){ + GElf_Sym sym; + const char *name; + GElf_Addr addr = arch_plt_sym_val(lte, i, 0); + if (gelf_getsym(lte->dynsym, i, &sym) == NULL){ + error(EXIT_FAILURE, 0, + "Couldn't get relocation from \"%s\"", + proc->filename); + } + name=lte->dynstr+sym.st_name; + if(ELF64_ST_TYPE(sym.st_info) != STT_FUNC){ + debug(2,"sym %s not a function",name); + continue; + } + add_library_symbol(addr, name, &library_symbols, 0, + ELF64_ST_BIND(sym.st_info) != 0); + if (!lib_tail) + lib_tail = &(library_symbols->next); + } #else for (i = 0; i < lte->relplt_count; ++i) { GElf_Rel rel; @@ -538,7 +538,7 @@ struct library_symbol *read_elf(struct process *proc) if (proc->need_to_reinitialize_breakpoints) { /* Add "PLTs_initialized_by_here" to opt_x list, if not - already there. */ + already there. */ main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t)); if (main_cheat == NULL) error(EXIT_FAILURE, 0, "Couldn't allocate memory"); |