size is
$ size /bin/ls
   text    data     bss     dec     hex filename
  65254    1108     872   67234   106a2 /bin/ls

objdump -p

will also give the same stuff as you've pointed out with the program
header sections... the load r_x segment contains more than just the .text
segment it also contains the .rodata and a couple of other things...

Dave.

>
> ianw@mingus:/bin$ readelf --segments ls
>
> Elf file type is EXEC (Executable file)
> Entry point 0x10001368
> There are 6 program headers, starting at offset 52
>
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   PHDR           0x000034 0x10000034 0x10000034 0x000c0 0x000c0 R E 0x4
>   INTERP         0x000114 0x10000114 0x10000114 0x0000d 0x0000d R   0x1
>       [Requesting program interpreter: /lib/ld.so.1]
>   LOAD           0x000000 0x10000000 0x10000000 0x12540 0x12540 R E 0x10000
>   LOAD           0x012540 0x10022540 0x10022540 0x00630 0x00e80 RWE 0x10000
>   DYNAMIC        0x012a14 0x10022a14 0x10022a14 0x000d0 0x000d0 RW  0x4
>   NOTE           0x000130 0x10000130 0x10000130 0x00020 0x00020 R   0x10
>
> the two sections of type PT_LOAD are the code and data segments.  the
> one with RWE permissions is the data segment, the other segment with
> only R E permissions is your Text (or code) segment.  MemSiz is how
> big they are in memory.
>
> -i
> [EMAIL PROTECTED]
> http://www.gelato.unsw.edu.au
>

-- 
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [EMAIL PROTECTED]
pam_smb / Linux DecStation / Linux VAX / ILUG person


-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to