Search code examples
iossizesymbolsnm

How can I get the actual size impact of each symbol in my binary?


I want to understand how much each symbol, e.g. functions, affect the size of my binary. I've tried using nm my_binary, sorted by address, and taken the offset between each address and the one after it to get the size for that symbol. I've also used the sizes reported in the link map from ld. Each has given similar results. However, the result is one whose sum is 122MB, whereas the size of the binary, stripped is 105MB, and the size of the __TEXT __text segment is only 70MB. Any ideas what might be the issue? This is for an arm64 iOS binary.


Solution

  • It turns out that I was including zerofill sections like __bss in my size calculation. Without these, I get the correct answer.