c++ - Accessing particular section in ELF -


we have program in section added named .proghead.

i can read elf .proghead section data using following command,

$ readelf -x .proghead  elf-binary-file  hex dump of section '.proghead':   0x0058b960 00112233 00000000 00010000 00000000 .."3............   0x0058b970 15200704 00000000 00016904 00000000 . ........i..... 

now have access section using c/c++ program.

can please me in writing c/c++ code read particular section in elf binary ?

any highly appreciated .

what need read section headers (elf64_shdr) find section names , offset. relevant information lies in sh_name , sh_offset fields. need compare sh_name required section. on finding required section, can offset(sh_offset) , size sh_size. easy data through loop reads sh_offset sh_offset+sh_offset+sh_size. theoretically correct , hope data of required section further check following links get elf sections offsets how pointer specific section of program within itself? (maybe libelf)


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -