简体   繁体   中英

How to find the number of entries in the .dynamic section of an ELF file?

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM