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

Alexey Samsonov samsonov at google.com
Wed Apr 25 04:51:47 PDT 2012


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/

--
Alexey Samsonov, MSK
Software Engineer, Google
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120425/00159489/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gline_tables_only.patch
Type: application/octet-stream
Size: 20098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120425/00159489/attachment.obj>


More information about the cfe-commits mailing list