I need to access .symtab symbol table by parsing memory of the process.
At the moment, my algorithm is:
- Get Dynamic segment (Program's header p_type == PT_DYNAMIC) and follow p_vaddr
- Search in this Dynamic Section for the DT_SYMTAB d_tag and take ptr from +4 offset (d_ptr), which should be our actual .symtab Symbol Table.
However, instead of .symtab, for some reason, I'm receiving .dynsym, which is proved by comparing symbol names and other info retrieved from readelf -Ws.
So, how to get the actual .symtab ptr? Thank you.
For reference, I'm using:
- https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#Program_header
- http://labmaster.mi.infn.it/Laboratorio2/CompilerCD/clang/l1/ELF.html
More good resources are appreciated.