My intention is to read an ELF file, then append some data to the end of a
section, then update the existing ELF file.
I wrote a small example program that works fine with libelfg0, but it fails
to append with elfutils (it replaces the data instead of appending to it).
The following is observed on Ubuntu-11.10 (installed version of libelf1 is
0.152). I have attached a small example program that demonstrates the
behavior.
With libelfg0 version 0.8.13 the effect of the elf_newdata() call is to
__append__ the new data buffer to the end of any existing data in a section.
However, with libelf1 the elf_newdata() call actually __replaces__ existing
data when elf_update() executes.
The man page at
http://docs.oracle.com/cd/E19253-01/816-5172/elf-getdata-3elf/index.htmls...
that appending is the intended behavior. Can anyone confirm this?
It would be very inconvenient to have two libraries in the world that seem
to provide the same source-level API but with slightly different semantics
...
Thanks for clearing this up,
Paul Stravers