Unix Programming - sum of segment size and executable size

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2004 > sum of segment size and executable size





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author sum of segment size and executable size
sachin_mzn@yahoo.com

2004-12-30, 2:47 am

Hi,
why I am getting different size value if i run "size" command and if i
see using "ls -l" on an object file.

my.c file contains only one empty function
my.c

f()
{
}
The Output of size command on HPUX

$ size my.o
8 + 0 + 0 = 8 ( here 8 is text segment size, rest is 0 )

$ ls -l my.o
-rw-rw-r-- 1 odcqa1 users 696 Dec 30 11:41 my.o

Can any one explain me? Why the size of my.o is larger than total of
it's segment's size.

-Sachin

Rich Gibbs

2004-12-30, 5:53 pm

sachin_mzn@yahoo.com said the following, on 12/30/04 01:22:
> Hi,
> why I am getting different size value if i run "size" command and if i
> see using "ls -l" on an object file.
>
> my.c file contains only one empty function
> my.c
>
> f()
> {
> }
> The Output of size command on HPUX
>
> $ size my.o
> 8 + 0 + 0 = 8 ( here 8 is text segment size, rest is 0 )
>
> $ ls -l my.o
> -rw-rw-r-- 1 odcqa1 users 696 Dec 30 11:41 my.o
>
> Can any one explain me? Why the size of my.o is larger than total of
> it's segment's size.
>


Because the object file contains header information in addition to the
actual executable code and data. For example, it probably contains
things like a "magic number" (for 'file'), the size data that 'size'
prints, an external symbol table, and so on.


--
Rich Gibbs
rgibbs@alumni.princeton.edu

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com