A section in an ELF executable file has a virtual address where it will be loaded when the program is executed.
Similarly, loadable segments also have their vaddr and a segment will comprise of one or more sections.
But these addresses appear to be relative to a base address as the ELF spec mentions (refer the attached screenshot)
Based on this information, I’ve the following question:
I have the vaddr of a section but I don’t know which segment it lies in. In that case, can I simply use the base address to find that section in a running program? i.e. actual address of the section in memory = base address + vaddr of the section in ELF header?
Or, there is a possibility of this not working in some cases?