sum of segment size and executable size

  • Follow


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

0
Reply sachin_mzn (21) 12/30/2004 6:22:27 AM

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

0
Reply Rich 12/30/2004 5:51:35 PM


1 Replies
339 Views

(page loaded in 0.056 seconds)

Similiar Articles:













7/24/2012 7:06:24 PM


Reply: