size
Function
size print the size of the sections in an object file
Explanation
❯ size -m monarch
Segment __PAGEZERO: 4294967296 (zero fill)
Segment __TEXT: 32768
Section __text: 16560
Section __stubs: 408
Section __cstring: 1244
Section __const: 99
Section __eh_frame: 2392
total 20703
Segment __DATA_CONST: 16384
Section __got: 296
total 296
Segment __DATA: 16384
Section __data: 16
total 16
Segment __LINKEDIT: 16384
total 4295049216
輸出中各 Segment 的用途:
__PAGEZERO:虛擬位址保留區(zero fill),用於捕捉 NULL pointer dereference__TEXT:唯讀可執行區,含機器碼、字串常數等__DATA_CONST:唯讀指標區,含 GOT (Global Offset Table)__DATA:可讀寫區,存放已初始化的全域變數__LINKEDIT:連結器元資料,供 dyld (Dynamic Linker) 使用
這個指令看的是 program size 而非 process,所以未初始化變數不會顯示在這裡