Re: Compiling x86 with and without frame pointer

David Zaffiro (davzaffiro@netscape.net)
Mon, 25 Nov 2002 09:47:00 +0100


I can understand why not omitting framepointers generates better
compressible code, since every function will start with:
push %ebp
mov %esp,%ebp
and end with:
leave
ret

But it's harder to find a reason why -fomit-frame-pointer is better
compressible that -momit-leaf-frame-pointer (but it's probably related
to a lot of mov's with stackpointer involved), especially since
"-momit-leaf-frame-pointer" makes a trade-off between both other
options: it omits framepointers for leaf functions (callees that aren't
callers as well) and it doesn't for branch-functions.
The mixture of functions with frame-pointers and those without is
probably causing bzip to compress less optimal.

Anyway it makes me wonder, whether kernelcompilation shouldn't be
configurable between a "optimize for (compressed image) size" and a
"optimize for speed" option... I'd go for speed... (and always omitting
frame-pointers doesn't seem to as fast as omitting them only in leaf
functions).

> Well, I tried on a 2.4.18+patches with gcc 2.95.3. bzImage is :
> 538481 bytes with -fomit-frame-pointer
> 538510 bytes with no particular flag
> 542137 bytes with -momit-leaf-frame-pointer.
>
> So -fomit-frame-pointer shows the same as other's observation, but in this
> particular case, -momit-leaf-frame-pointer made a slightly bigger kernel.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/