Need to read .symtab

Posted by user361190 on Stack Overflow See other posts from Stack Overflow or by user361190
Published on 2010-06-08T09:19:31Z Indexed on 2010/06/08 9:22 UTC
Read the original article Hit count: 254

Filed under:
|

I am frustrated. I have a simple doubt .. I compile a simple program with gcc and if I see the section header using objdump, it does not show the section ".symtab". for the same a.out file, readelf shows the section. see the below snip -

[25] .symtab SYMTAB 00000000 000ca4 000480 10 26 2c 4 [26] .strtab STRTAB 00000000 001124 00025c 00 0 0 1

Why ?

In the default linker script I don't find a definition for .symtab section. If I add a definition by myself like in the linker script :

.... PROVIDE(__start_sym) .symtab : { *(.symtab)} PROVIDE(__end_sym) ....

the difference b/w the addresses of __start_sym and __end_sym is zero, which means no such section is added in the output file.

But the readelf is able to read the section and dump the contents of this section .. How ? why ?

© Stack Overflow or respective owner

Related posts about c

    Related posts about linker