Unomitted frame pointers

Sam Lauber sam124@operamail.com
Fri Dec 10 05:26:00 GMT 2004


Going back to useless assembly, a low-level Hello World with -fno-omit-frame-pointer:

        .file   "hello.c"
        .section        .rodata
.LC0:
        .string "Hello World!\n"
        .string ""
        .text
.globl main
        .type   main, @function
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        andl    $-16, %esp
        movl    $0, %eax
        addl    $15, %eax
        addl    $15, %eax
        shrl    $4, %eax
        sall    $4, %eax
        subl    %eax, %esp
        movl    $16, 8(%esp)
        movl    $.LC0, 4(%esp)
        movl    $2, (%esp)
        call    write
        movl    $0, %eax
        leave
        ret
        .size   main, .-main
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.3"

And the same C code with -fomit-frame-pointer:

        .file   "hello.c"
        .section        .rodata
.LC0:
        .string "Hello World!\n"
        .string ""
        .text
.globl main
        .type   main, @function
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        andl    $-16, %esp
        movl    $0, %eax
        addl    $15, %eax
        addl    $15, %eax
        shrl    $4, %eax
        sall    $4, %eax
        subl    %eax, %esp
        movl    $16, 8(%esp)
        movl    $.LC0, 4(%esp)
        movl    $2, (%esp)
        call    write
        movl    $0, %eax
        leave
        ret
        .size   main, .-main
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.3"

Clearly some one (or some code) isn't doing its job! The original C code is attached. I thought -fomit-frame-pointer is supposed to OMIT the frame pointer!

Samuel Lauber
-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.

Powered by Outblaze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.c
Type: application/octet-stream
Size: 65 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20041210/da177079/attachment.obj>


More information about the Gcc mailing list