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.

See elf_update.cpp:_libelf_update_elf.


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?