<div class="__aliyun_email_body_block"><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Hi Jeremy and David,</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div style="clear:both;"> The most significant reduction comes from the section `.debug_loc` and `.debug_info` section.</div><div style="clear:both;"> The size of `.debug_info` reduced about 14% and the size of of `.debug_loc` reduced to even 69%!</div><div style="clear:both;"><br ></div><div style="clear:both;"> I would try the patches in the link. </div><div style="clear:both;"><br ></div><div style="clear:both;">Thanks,</div><div style="clear:both;">Chuanqi</div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><blockquote style="margin-right:0;margin-top:0;margin-bottom:0;"><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:David Blaikie <dblaikie@gmail.com></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2021年3月31日(星期三) 00:24</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:Jeremy Morse <jeremy.morse.llvm@gmail.com></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Cc:chuanqi.xcq <yedeng.yd@linux.alibaba.com>; llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [llvm-dev] Why the binary size in trunk are smaller significantly?</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div >Yep, I'd be curious to see more data - comparisons of sections sizes (<a href="https://github.com/google/bloaty" target="_blank">Bloaty</a> is a handy tool to make comparisons simpler (though for a one off might not be worth the hassle of going and downloading/building it/etc)) & any work that could be done isolating/reducing the test case (hopefully enough that it can be shared) and verifying what differences might exist between the two compilations if there's anything other than the compiler version.</div><br ><div class="gmail_quote"><div class="gmail_attr">On Tue, Mar 30, 2021 at 3:33 AM Jeremy Morse <<a href="mailto:jeremy.morse.llvm@gmail.com" target="_blank">jeremy.morse.llvm@gmail.com</a>> wrote:<br ></div>Hi Chuanqi,<br ><br >
On Tue, Mar 30, 2021 at 9:47 AM chuanqi.xcq via llvm-dev<br >
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br >
> In a private code bases, I find that the binary size produced in llvm-11 is 60M while the size produced in trunk is 51M.<br >
><br >
> I tried to find the patch who made this change in git log or in phabricator by keywords like `reduce`, 'size' or 'binary'. But I find nothing.<br ><br >
Interesting -- which sections reduce in size between llvm-11 and<br >
trunk? Assuming you're using ELF/DWARF binaries, `readelf -W -S` will<br >
give you sections and sizes.<br ><br >
Since llvm-11 branched, there were some patches [0] that improved how<br >
variable locations are represented in DWARF, I've seen some binaries<br >
where that reduced file size by 10%. That would be reflected in the<br >
.debug_loc section. There's also the constructor homing flag, passed<br >
to clang with "-Xclang -fuse-ctor-homing", I'm not sure whether it's<br >
on by default in trunk. That would show a significant reduction in the<br >
.debug_info section.<br ><br >
[0] <a href="https://reviews.llvm.org/rG0b5a8050ea39355a3876cc6bba9383d91e224e1f" target="_blank">https://reviews.llvm.org/rG0b5a8050ea39355a3876cc6bba9383d91e224e1f</a><br ><br >
--<br >
Thanks,<br >
Jeremy<br ></div></blockquote><div ><br ></div></div>