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:
[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 ?