On Tue, Aug 21, 2018 at 12:16:09AM +0800, Henry C wrote: > Tho, I have no clue how to get the index to each of the string in the > string table above.
The .rodata section isn't just a simple ELF string table. Otherwise you could use elf_strptr (see libelf.h) to index through them. But .rodata also contains other read only data. There is no simple ELF based index for just the strings. > And one more related question is that I noticed the virtual memory > addresses of the string literals are same as the offsets to the > (executable) file. Is it intended? Guaranteed? If you mean that the sh_offset and sh_addr are the same then that not guaranteed. The mapping from file offset to addresses for allocated sections is given by the program headers. You can see how they are mapped exactly using eu-readelf -l. Cheers, Mark