serge1 / ELFIO

ELFIO - ELF (Executable and Linkable Format) reader and producer implemented as a header only C++ library
http://serge1.github.io/ELFIO
MIT License
729 stars 158 forks source link

Adding PROGBITS section #86

Closed dsnezhkov closed 2 years ago

dsnezhkov commented 2 years ago

Hi,

Is there an API to add an arbitrary PROGBITS section. I see the API can do notes, dynamic and strings types. For example, is it possible to create a section and add raw data buffer to the section without structured layout?

I am working off of the add_note example:

 note_sec->set_type( SHT_PROGBITS);
.. What is the correct accessor writer for this ? 
 note_writer.add_XXXX( &data_buffer, size );

thank you.

serge1 commented 2 years ago

Hi, An arbitrary PROGBITS section can be added by using 'section' API. Unstructured data can be set by added by set_data(). No special section accessor is required for this case. See "ELF File Writer" example in the documentation. The text and data sections are added without accessors.

Does it answer your question?

dsnezhkov commented 2 years ago

Perfect, Thank you!