The attached simple test case damages the target object file. AFAIK, it should make no changes whatsoever. All the documentation I've found (for either the SCO version or the Sun version) suggest that this is a perfectly valid use of elf_flagdata() and elf_update(). This is elfutils-0.119-1.2.1.
Created attachment 127186 [details] simple test usage of elf_update which damages the object file.
Created attachment 127187 [details] eu-readelf -a output from a victim object file, before being run through the test program
Created attachment 127188 [details] eu-readelf -a output from the victim object file, after being run through the test program
This is fixed in version 0.120 now in rawhide.
Created attachment 127487 [details] eu-readelf -a output from the victim object file, before being run through the test program with elfutils 0.120 I'm including this again because I lost the original test object.
Created attachment 127488 [details] eu-readelf -a output from the victim object file, after being run through the test program with elfutils 0.120 Looking at a comparison of the before & after, it appears that the contents of .shstrtab is getting lost. (There's also differences in object layout, but I think that's purely a "libelf does things differently than libbfd" issue.)
The development version of the code has no such problem anymore. The package maintainer will make a new release sometime soon but it'll be at least a week, I guess.
We think this is fixed in 0.121, which will appear in rawhide as soon as it percolates through, and can already be found at ftp://sources.redhat.com/pub/systemtap/elfutils/ to try it out now. Please verify that your bug no longer occurs.
It's fixed. Thanks.