<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 5, 2012, at 10:24 AM, Alexey Samsonov wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi!<div><br></div><div>Currently Clang "-g" flag emits full debug info, which is fine for debugging, but increases the binary size significantly.</div><div>It may be useful to produce less debug info, that is still enough for collecting nice stack traces with file names and line numbers,</div></blockquote><blockquote type="cite"><div>but would introduce less overhead. </div></blockquote><div><br></div><div>Sounds great!</div><div><br></div><blockquote type="cite"><div>Cary Coutant made a patch which does this for GCC (it didn't hit trunk yet) -</div><div>reduces debug info to only descriptions of functions, extern variables, line number tables and inlined subroutine info</div>
<div>by setting "-gmlt" ("minimum line table") or "-g1" flags.</div></blockquote><div><br></div><div>"-gmlt" is a really unfortunate option name.  Why not -gline-tables-only or something like that?</div><br><blockquote type="cite"><div>(See this patch at <a href="http://old.nabble.com/-patch--Add-new--gmlt-option-for-min.-debug-info-with-line-tables-(issue4440072)-td31482851.html">http://old.nabble.com/-patch--Add-new--gmlt-option-for-min.-debug-info-with-line-tables-(issue4440072)-td31482851.html</a></div>
<div>or <a href="http://codereview.appspot.com/4440072">http://codereview.appspot.com/4440072</a>). This patch is used in Google for about 2 years already.</div><div><br></div><div>I get the following binary sizes of 483.xalancbmk benchmark from SPEC 2006 (clang from trunk vs. gcc 4.6.x with Google patches):</div>
<div>11026073 Xalan_base.clang_O0</div><div><div>45882529 Xalan_base.clang_O0_g</div><div>11079688 Xalan_base.gcc_O0</div><div>16437776 Xalan_base.gcc_O0_gmlt</div><div>54221056 Xalan_base.gcc_O0_g</div><div><br></div></div>
<div>WDYT of implementing similar option in Clang? Clearly, there are two options:</div><div>1. Don't modify Clang codegen, but instead erase all the extra debug info by LLVM (pro - there actually is StripDebugInfo pass already, but it's very short and easy,</div>
<div>and would have to be patched a lot).</div><div>2. Emit less information in Clang. We're also quite interested if this may reduce the compilation time as well.</div><div>Which approach looks better in your opinion? I'd like to start working on that enhancement, but certainly would be happy to hear some advice beforehand.</div>
</blockquote><br></div><div>#2 is definitely the right way to go, thanks!</div><div><br></div><div>-Chris</div><br></body></html>