On Thursday 12 June 2014 14:30:52 Mark Wielaard wrote:
Thanks. It think that shows the second bug you describe.
First bug. My testcase first uses elf_strptr() to get the strings for the symbols, and that func internally calls elf_rawdata() thus triggering the first bug described.
Still scratching my head a little how to resolve both issues properly.
Hmm.. I didn't do any debugging on the second bug reported, but it seems to me that once a section was marked dirty, outputting to a new elf causes it to only consider data explicitly added to the lib internal memory representation of the elf. It _did_ write out the data I added via elf_newdata(), and entered the appropriate offsets into the header file, but completely omitted copying of the original data.
These issues can all be worked around with by explicitly calling elf_getdata().
Still, I'm a bit baffled that a bug like this could exist for so long in .. well I guess these are kind of core developer utils, right? Or maybe I'm doing some really sick stuff noone else dreamt up yet ;)