1

Can there be a method determining the number of entries in the .dynamic section of an ELF file without using the readelf utility? I am trying to output data from the .dynamic section using the gelf_getdyn() function, but cannot figure out a way of programmatically finding the number of entries in this section. Any help or webpages that can help (cannot find the source code for readelf) would be extremely appreciative.

nice_remark
  • 325
  • 3
  • 12

1 Answers1

1

cannot figure out a way of programmatically finding the number of entries in this section

You simply iterate over all entries until you encounter an entry with d_tag == DT_NULL. That entry terminates the array. Reference.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362