From: Joseph K. <jk...@us...> - 2012-02-18 06:39:44
|
> I am trying to get elftoolchain to generate a read-write elf that > actually works, however, everytime I call update(ELF_C_WRITE), > almost all of the data structures get destroyed. The internal data structures associated with an ELF object do get freed on successful completion of an elf_update(ELF_C_WRITE) operation. Applications are required to retrieve this information afresh from the ELF descriptor after calling elf_update(ELF_C_WRITE). > See elf_update.cpp:_libelf_update_elf. What is "elf_update.cpp" here? If there was an attachment with example code, it does not seem to have come through. > Now, since I have a new raw elf data, how do I reconstruct the in > memory elf data structure from the rawelf file that was returned in > __libelf_update_elf? I'm not sure I understand the question. After a call to elf_update(3), you should be able to query the new contents of the ELF object using the functions in GELF(3)/ELF(3) API (i.e., gelf_getehdr, gelf_getphdr, elf_getscn, etc.), just as you would for a fresh ELF descriptor. Hope this helps. Regards, Koshy |