[cfe-commits] [PATCH] "-gline-tables-only" flag for Clang

Eric Christopher echristo at apple.com
Wed Apr 25 13:44:03 PDT 2012


On Apr 25, 2012, at 4:51 AM, Alexey Samsonov <samsonov at google.com> wrote:

> Hi, cfe-commits!
> 
> This patch adds a new Clang compiler flag "-gline-tables-only". It should reduce the amount of emitted debug information:
> 1) DIEs in .debug_info should only have types DW_TAG_compile_unit, DW_TAG_subprogram, DW_TAG_inlined_subroutine (for opt builds), DW_TAG_lexical_block.
> 2) .debug_str should only contain function names
> 3) No debug data for types/namespaces/variables should be emitted.
> 4) The data in .debug_line should be enough to produce valid stack traces with function names and line numbers.
> 
> This flag can reduce the size of the binary by some factor, but still allow to obtain valid stack traces (both for debug and opt builds, and for inlined functions).
> Results of measurements on SPEC CPU 2006 benchmarks (for Clang r155349):
> 
> binary size increase factor for:
> "-O0 -g": average - 2x, max - 5.85x
> "-O0 -gline-tables-only": average - 1.2x, max - 1.44x
> "-O2 -g": average - 3.45x, max - 11x
> "-O2 -gline-tables-only": average - 1.47x, max - 2.76x
> 
> Similar patch exists for gcc but is not yet in trunk
> (See this patch at http://old.nabble.com/-patch--Add-new--gmlt-option-for-min.-debug-info-with-line-tables-(issue4440072)-td31482851.html
> or http://codereview.appspot.com/4440072). gcc patch is used in Google for about 2 years already.
> 
> You can review the Clang patch at: http://codereview.appspot.com/6112056/

So two requests:

a) Please do turn it into an enum and refactor the current uses before as a separate patch.
b) I think the fixme should be fixed first. Also, no need to put your name next to a fixme.

Otherwise it looks fine.

-eric



More information about the cfe-commits mailing list