Ping
Thanks, Ying 在 2024/9/27 17:52, Ying Huang 写道: > Ping > > > Thanks, > > Ying > > > 在 2024/9/14 17:45, Ying Huang 写道: >> Ping >> >> >> Thanks, >> >> Ying >> >> >> 在 2024/8/30 17:04, Ying Huang 写道: >>> Hi Mark, >>> >>> What can I do to process these patches? >>> >>> If you did not accept changes in current patch, how about the following >>> changes method? >>> >>> diff --git a/libelf/gelf_getrela.c b/libelf/gelf_getrela.c >>> index d695f659..fd974bdf 100644 >>> --- a/libelf/gelf_getrela.c >>> +++ b/libelf/gelf_getrela.c >>> @@ -90,8 +90,21 @@ gelf_getrela (Elf_Data *data, int ndx, GElf_Rela *dst) >>> result = NULL; >>> } >>> else >>> - result = memcpy (dst, &((Elf64_Rela *) data_scn->d.d_buf)[ndx], >>> - sizeof (Elf64_Rela)); >>> + { >>> + result = memcpy (dst, &((Elf64_Rela *) data_scn->d.d_buf)[ndx], >>> + sizeof (Elf64_Rela)); >>> + GElf_Ehdr ehdr_mem; >>> + GElf_Ehdr *ehdr = __gelf_getehdr_rdlock (scn->elf, &ehdr_mem); >>> + if(ehdr != NULL && ehdr->e_machine == EM_MIPS && >>> ehdr->e_ident[EI_DATA] == ELFDATA2LSB) >>> + { >>> + Elf64_Xword info = dst->r_info; >>> + dst->r_info = (((info & 0xffffffff) << 32) >>> + | ((info >> 56) & 0xff) >>> + | ((info >> 40) & 0xff00) >>> + | ((info >> 24) & 0xff0000) >>> + | ((info >> 8) & 0xff000000)); >>> + } >>> + } >>> } >>> >>> rwlock_unlock (scn->elf->lock); >>> >>> diff --git a/libelf/gelf_update_rela.c b/libelf/gelf_update_rela.c >>> index 88252703..592d74b9 100644 >>> --- a/libelf/gelf_update_rela.c >>> +++ b/libelf/gelf_update_rela.c >>> @@ -96,7 +96,20 @@ gelf_update_rela (Elf_Data *dst, int ndx, GElf_Rela *src) >>> goto out; >>> } >>> >>> - ((Elf64_Rela *) data_scn->d.d_buf)[ndx] = *src; >>> + GElf_Ehdr ehdr_mem; >>> + GElf_Ehdr *ehdr = __gelf_getehdr_rdlock (scn->elf, &ehdr_mem); >>> + GElf_Rela rela = *src; >>> + if(ehdr != NULL && ehdr->e_machine == EM_MIPS && >>> ehdr->e_ident[EI_DATA] == ELFDATA2LSB) >>> + { >>> + Elf64_Xword info = rela.r_info; >>> + rela.r_info = (info >> 32 >>> + | ((info << 56) & 0xff00000000000000) >>> + | ((info << 40) & 0xff000000000000) >>> + | ((info << 24) & 0xff0000000000) >>> + | ((info << 8) & 0xff00000000)); >>> + } >>> + >>> + ((Elf64_Rela *) data_scn->d.d_buf)[ndx] = rela; >>> } >>> >>> result = 1; >>> >>> >>> If you have any other questions, please let me know. >>> >>> >>> Thanks, >>> >>> Ying >>>