Description
Bugzilla Link | 43162 |
Version | trunk |
OS | Windows NT |
CC | @Bigcheese,@rupprecht |
Extended Description
llvm-size, like GNU size, uses the section headers to determine the sizes it will print. However, this doesn't really reflect what the memory usage of a program might be, because, for example, it doesn't take account of between-section padding, stripped sections (e.g. via llvm-objcopy --strip-sections) and so on. It might be nice if we added a new switch (possibly a new --format option) to print the sizes as a loader might see, namely the size of all loadable segments, probably broken down by segment. It may or may not make sense to print the sizes of other (non-loadable) segments. I'm open to ideas for formatting etc. It probably makes sense to look similar to sysv output, listing each segment, in order, with type, flags, file size, and memory size listed. Possibly a Total line would only include the real size (i.e. nested segment sizes wouldn't be included).
Example:
Index Type Flags FileSize MemSize
1 LOAD RX 10 10
2 LOAD RW 8 20
3 TLS RW 4 10
4 GNU_RELRO RW 4 4
4 NOTE R 20 0
Total 38 3c
(I've assumed special-handling of PT_TLS in the above example, since it looks to be nested, but takes up additional memory not included in the parent segment).