http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53380

             Bug #: 53380
           Summary: .ehframe could be smaller
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: msha...@users.sourceforge.net


The unwinding information can take up a significant (10%+) chunk of a C++
executable, and reducing its size can help make executables smaller. On x86_64
in particular, the need to include .ehframe erases code size reductions
acquired when porting 32bit code, and gives the incorrect impression that 64
bit code is larger. Fortunately, it is possible to make the unwinding table
smaller.

The entries for functions without local variables are basically empty, the
information contained being largely the offset and size of the function body.
If this type of entry was made the default action, all of them could be
removed. Then any function not found in the table would be assumed to have the
return address on top of the stack. Validity checking can still be performed by
verifying that the return address is in .text. Another optimization is to
remove entries for functions that do not throw; i.e. declared as noexcept or
not calling any other functions that are not noexcept.

Just doing these two things should remove more than half the table in a typical
executable. Of course, unwinding information is also used by the debugger and
backtrace, so the table should be left alone by default. It would be nice to
have the option to turn them on explicitly.

Reply via email to