I get some symbol and I get the hexedit of an elf file. How can I know in which section this symbol appear?
What is the different between
strtab
andshstrtab
? there is also an array of symbol strings?
When I get index in the names table, is it index in strtab
or shstrtab
?
For the first question, we would need the hexedit of the elf file to understand properly.
For the second question - strtab stands for String Table shstrtab stands for Section Header String table.
When we read ELF header, we see that every ElfHeader structure contains a member called e_shstrndx. This is an index to the shstrtab. If you use this index and then read from shstrtab you can find the name of that section.
strtab, is the string table for all other references. When you read symbols from an ELF object, every SYmbol structure (Elf32_Sym) has a member called st_name. This is an index into strtab to get the string name of that symbol.
Can you please elaborate more on array of symbol strings? Also, what do you mean by names table?
You can refer to the following link - Reading ELF String Table on Linux from C
Hope this answers your question.
来源:https://stackoverflow.com/questions/11289843/string-table-in-elf