Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translate virtual addresses to binary addresses for shared libs as well.
Quoting https://refspecs.linuxbase.org/elf/elf.pdf: ``` Symbol table entries for different object file types have slightly different interpretations for the st_value member. - In relocatable files, st_value holds alignment constraints for a symbol whose section index is SHN_COMMON. - In relocatable files, st_value holds a section offset for a defined symbol. That is, st_value is an offset from the beginning of the section that st_shndx identifies. - In executable and shared object files, st_value holds a virtual address. To make these files' symbols more useful for the dynamic linker, the section offset (file interpretation) gives way to a virtual address (memory interpretation) for which the section number is irrelevant. ``` This is a problem in practice as well. I run into this while tracing shared libraries on Android with bpftrace. Some of them have text sections mmapped at different offset than file offset which results in probes being placed at wrong offsets.
- Loading branch information