Re: Bug: gcc ignores ebp clobber
Stefan Hajnoczi <[email protected]>
| Newsgroups | gmane.network.etherboot.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks for pointing this out! Summary of the bug: GCC does not cope with the frame pointer being clobbered by inline asm. It produces no error during compilation but makes no effort to preserve the frame pointer as the user has indicated in the clobber list. >From the bug report: "If I compile the test case from that bug with -fomit-frame-pointer, gcc still generates invalid code. (We don't use frame pointers in our system at all)." gPXE builds with -fomit-frame-pointer. This actually reduces the chance of this bug being noticed since %ebp may not be live. When used as a frame pointer you *will* get hit by this bug :). In fact, when I look at the emitted code, I do not see a single instance where broken code is being produced. With gcc (Debian 4.3.3-14) 4.3.3 and the latest gpxe.git tree: ./arch/i386/drivers/net/undiload.c: : "ebx", "ecx", "edx", "esi", "edi", "ebp" ); %ebp not live across inline asm. ./arch/i386/drivers/net/undinet.c: : "ecx", "edx", "esi", "ebp" ); %ebp not live across inline asm. ./arch/i386/interface/pxe/pxe_call.c: : "esi", "ebp", "memory" ); %ebp not live across inline asm. ./arch/i386/firmware/pcbios/bios_console.c: : "ebp" ); %ebp not live across inline asm. ./arch/i386/image/nbi.c: : "ecx", "edx", "ebp" ); ./arch/i386/image/nbi.c: : "ecx", "edx", "ebp", "memory" ); %ebp not live across inline asm. ./arch/i386/image/elfboot.c: : "eax", "ebx", "ecx", "edx", "esi", "ebp", %ebp not live across inline asm. ./arch/i386/image/bootsector.c: : "eax", "ecx", "esi", "ebp" ); %ebp not live across inline asm. We should still fix this since a new version of GCC may come along and decide to use %ebp in one of these functions. Stefan ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july