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.
Asked
Active
Viewed 505 times
1

nice_remark
- 325
- 3
- 12
-
readelf is part of binutils, look at that for the source. – SoronelHaetir Jan 11 '18 at 20:06
1 Answers
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