Page MenuHomePhabricator

Calculate correct section sizes for llvm-size
ClosedPublic

Authored by khemant on Feb 2 2016, 11:23 AM.

Details

Summary

llvm-size adds sections such as symbol table etc. into size totals. This is incorrect. BSD utilty does not:
$llvm-size -A a.o
a.o :
section size addr
.text 77 0
.data 0 0
.bss 0 0
.comment 44 0
.note.GNU-stack 0 0
.eh_frame 248 0
.rela.eh_frame 168 0
.shstrtab 84 0
.symtab 432 0
.strtab 52 0
Total 1105

$size -A a.o
a.o :
section size addr
.text 77 0
.data 0 0
.bss 0 0
.comment 44 0
.note.GNU-stack 0 0
.eh_frame 248 0
Total 369

Diff Detail

Repository
rL LLVM

Event Timeline

khemant updated this revision to Diff 46683.Feb 2 2016, 11:23 AM
khemant retitled this revision from to Calculate correct section sizes for llvm-size.
khemant updated this object.
khemant added reviewers: llvm-commits, davide.
khemant set the repository for this revision to rL LLVM.
khemant added subscribers: llvm-commits, davide, echristo.
mgrang added a subscriber: mgrang.Feb 2 2016, 11:29 AM
mgrang added inline comments.
tools/llvm-size/llvm-size.cpp
124

Could you write this as a switch-case? Would make future maintenance easier.

davide edited edge metadata.Feb 2 2016, 11:45 AM

What's the output of binutils size?

tools/llvm-size/llvm-size.cpp
22

Unsorted I guess?

120

No need to call getType() each time.

Binutils size outputs similar to BSD. It discounts these sections as well

tools/llvm-size/llvm-size.cpp
22

Correct. Will be putting in right place.

120

I will be changing this to switch as mgrang mentioned.

khemant updated this revision to Diff 46688.Feb 2 2016, 12:51 PM
khemant edited edge metadata.
khemant marked 3 inline comments as done.

Looks good. Thanks for the testcase/fix.

davide accepted this revision.Feb 2 2016, 12:56 PM
davide edited edge metadata.
This revision is now accepted and ready to land.Feb 2 2016, 12:56 PM
khemant closed this revision.Feb 2 2016, 1:51 PM

Committed r259578