Re: Accessing String Table Indexes for .rodata

2018-08-31 Thread Henry C
I wonder under what situation Elf64_Shdr::sh_addr won't represent the virtual address of the beginning of .rodata section. Thanks in advance! On Fri, Aug 31, 2018 at 7:33 PM Mark Wielaard wrote: > > On Fri, 2018-08-31 at 19:07 +0800, Henry C wrote: > > Thanks for replying. >

Re: Accessing String Table Indexes for .rodata

2018-08-31 Thread Henry C
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 i

Accessing String Table Indexes for .rodata

2018-08-20 Thread Henry C
Hi, I have a sample code like this: #include void myprintf(const char* ptr) { printf("%p\n", ptr); } int main() { myprintf("hello world"); myprintf("\0\0"); myprintf("ab\0cde"); } I would like to access the .rodata by using elf.h. Someone told me this is the ri