Reputation: 49
Given the following output of the "size" command on Mac OS X 10.5 on an small executable, what is the value under __DATA? Is it the uninitialized data segment size or initialized data segment size? What I find confounding is that this value (nor the rest of the values) does not seem to change whether I initialize (the one and only) global array in the program or not.
I guess this command works differently on Linux and Mac?
__TEXT __DATA __OBJC others dec hex
4096 4096 0 4294971392 4294979584 100003000
Upvotes: 3
Views: 1105
Reputation: 90671
All statics and globals are initialized, it's just a question of whether they are initialized to zero or some other value. Variables initialized to zero go into the __bss section of the __DATA segment. Other variables will go into other sections of the __DATA segment.
Upvotes: 1
Reputation: 28565
On linux, the format is
text data bss dec hex filename
1281 520 32 1833 729 a.out
BSS
is the size in bytes of the zero initialized globals and local statics. I verified and they(data, bss etc) are changing appropriately with change in the number of variables and their initialized values.
One thing to note is, size
without any parameters automatically chooses a.out
in the CWD.
I am totally unaware of things in Mac. My guess is __OBJC
= BSS
. Also check how are you invoking the size
command
Upvotes: 1