How to access an applications ELF program header and ELF section header at runtime

Mike Frysinger vapier@gentoo.org
Tue Jan 5 23:27:00 GMT 2010


On Tuesday 05 January 2010 17:51:24 Bharath Ramesh wrote:
> I am trying to understand the format of /proc/self/maps. From looking at
> the map and the section headers from objdump of the application I have
> some understanding. It would be great if I someone can correct me if I
> am wrong.
> 
> 00400000-00401000 r-xp 00000000 08:02
>  5669441	/home/bharath/Research/code/test/globals/maps 00600000-00601000
>  r--p 00000000 08:02 5669441	/home/bharath/Research/code/test/globals/maps
>  00601000-00602000 rw-p 00001000 08:02
>  5669441	/home/bharath/Research/code/test/globals/maps 01e66000-01e88000
>  rw-p 00000000 00:00 0		[heap]
> <snip>
> 
> My understanding is as follows:
> 
> 1) Line 1 would be the mapping for the .text section of the application
> since it is read-only and executable.
> 2) Line 2 would be something to .got and other sections as it is
> read-only.
> 3) Line 3 corresponds to .data & .bss.

maps are created based on ELF PHDRs, not sections.  look at the LOAD lines in 
`readelf -l` on your binary.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-help/attachments/20100105/7bc136c6/attachment.sig>


More information about the Libc-help mailing list