This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unomitted frame pointers


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

Attachment: hello.c
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]