[PATCH] D94560: [ELF] report section sizes when output file too large

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 12:05:13 PST 2021


inglorion added a comment.

Thanks for the comments!

In D94560#2497393 <https://reviews.llvm.org/D94560#2497393>, @grimar wrote:

> E.g. I think it can be just a 2 lines loop which would iterate over all output sections and print their names ans sizes.
> No need to sort them or to calculate fields width.

The reason I do the sorting is because there can potentially be very many sections. Imagine a large binary with -fdata-sections -ffunction-settings. Similar to how we have an error limit to avoid spewing a bazillion error messages, I thought it would be a good idea to show the largest few sections, but not every handful of bytes datum or function in the program. That comes at the cost of adding a call to std::partial_sort_copy(), which doesn't seem too much of a maintenance headache.

As for formatting, I would be happy to remove that if we feel that would be better. I figured some sense of consistency between output formats would be good, but it's not actually the same as objdump -h anyway, so maybe it's not worth the code? Let me know what you think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94560/new/

https://reviews.llvm.org/D94560



More information about the llvm-commits mailing list