[PATCH] D146753: [llvm-readobj] Include section information in summary

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 17:00:01 PDT 2023


paulkirth added a comment.

In D146753#4291501 <https://reviews.llvm.org/D146753#4291501>, @jhenderson wrote:

> I'm wary of extending the information specifically for JSON dumping, as it doesn't feel right to me that this output format should provide information that isn't provided in at least the LLVM format too (in practice, the two should be identical, barring how things are formatted, in my opinion).

AFAIK the LLVM format doesn't have a summary, while JSON does. This seemed like a good place to put some summary info.

> You talk about how you are trying to understand size issues in this patch. Why does this mean JSON output specifically needs this info? llvm-size already provides similar sorts of information, so is this really the right tool for the job?

So if we're already processing a binary w/ `llvm-objdump` and consuming its JSON output it seems a lot nicer to get these statistics as part of the output rather than to invoke another tool. We can certainly reconstruct those values by post-processing the data, but it seemed trivial to add to the summary, since it was looping over the sections anyway.

> Also, the "debug" versus "remaining" (which should probably be "other") line is not particularly well-defined. For example, this patch treats some sections that are stripped with --strip-debug in llvm-objcopy as "remaining".

"Other" was my first thought, but I went w/ "Remaining", since I thought it was less confusing. Looking at it, I'd have to agree that "Other" is probably a better name.

I wasn't all that confident on the way the current implementation classifies non-allocated sections. Do you have any suggestions as to what would be a better approach? I didn't think any of the other section flags were a strong enough indicator, but I'll be the first to admit that object file flags aren't something I'm particularly well versed in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146753



More information about the llvm-commits mailing list