This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: increase in object code size
- To: Joe Buck <jbuck at synopsys dot com>
- Subject: Re: increase in object code size
- From: John Carr <jfc at mit dot edu>
- Date: Tue, 23 Sep 1997 14:45:12 EDT
- Cc: egcs at cygnus dot com
> > On 80386, -fno-exceptions reduces size by about 25%.
>
> That much? On sparc-sun-solaris2.5.1, size -A on a stripped cc1 from the
> latest snapshot gives
>
> section size addr
> .text 1537124 166460
> .eh_frame 72120 1980396
>
> .eh_frame is only 4.7% of .text here. Is the bloat that much larger
> for x86? Why?
On x86 every stack push requires a 7 byte entry in the traceback table
so the unwinder knows how to adjust the stack pointer to find the
return address.
The first optimization which comes to mind: an exception table entry
which does not apply to an instruction which can throw an exception
should be eliminated. In GNU C and C++ (and, I think, GNU Ada) only
function calls throw exceptions. That means there needs to be at most
one table entry per function call.
The second (x86 only): if a function does not have any exception
handlers and it has a frame pointer the unwinder does not need an
exception table. The return PC is at a known offset from the frame
pointer.
("exception handler" here includes implicitly defined handlers in C++
to call destructors for local variables.)