[Dwarf-Discuss] debugging information available at runtime?
ppluzhnikov at google.com
Tue Sep 8 23:53:10 PDT 2009
On Tue, Sep 8, 2009 at 11:41 PM, Brendan Miller<catphive at catphive.net> wrote:
> Interesting. So potentially I could just have a post build step that
> sets the SHF_ALLOC flag for .debug_line on my binaries and .so's to
> have them automatically brought into memory?
No: ELF format has "dual nature" -- it is used for both (static)
linking and (runtime) loading. The static linker (ld) operates on
sections, but the dynamic loader (ld-linux) doesn't care about
sections; it operates on segments. The section table could be
completely stripped, and the executable will continue to run just
You can examine what segments your executable has, and how sections
are mapped to segments with 'readelf -l a.out'. Sections absent from
'Section to Segment mapping' are not in any segment, and the loader
will not mmap them.
You could possibly make 'ld' put .debug_line into the read-only
PT_LOAD segment with a linker script (obviously this would be very
non-portable), but that is very advanced magic :-)
More information about the Dwarf-Discuss