gcc -S test.c -o test ??

Discussion in 'C Programming' started by Paminu, Nov 25, 2005.

  1. Paminu

    Paminu Guest

    The option -S produces the corresponding assembly code for a .c file in the
    file specified after -o. But where can I get a lsit of what the different
    expresssions mean?

    I have this example:


    cat test
    .file "mips.c"
    .text
    ..globl sub
    .type sub, @function
    sub:
    pushl %ebp
    movl %esp, %ebp
    movl 12(%ebp), %edx
    movl 8(%ebp), %eax
    subl %edx, %eax
    popl %ebp
    ret
    .size sub, .-sub
    .section .note.GNU-stack,"",@progbits
    .ident "GCC: (GNU) 3.3.5 (Debian 1:3.3.5-8ubuntu2)"

    I could be nice to get some information on what %ebp means.
     
    Paminu, Nov 25, 2005
    #1
    1. Advertising

  2. In article <dm829v$u9j$-c.dk>, Paminu <> wrote:
    >The option -S produces the corresponding assembly code for a .c file in the
    >file specified after -o. But where can I get a lsit of what the different
    >expresssions mean?


    Anything having to do with gcc specifically, or to do with assembly
    language, is platform specific, and should be referred to an
    appropriate newsgroup.


    [OT]


    >I have this example:


    > pushl %ebp
    > movl %esp, %ebp
    > movl 12(%ebp), %edx
    > movl 8(%ebp), %eax
    > subl %edx, %eax
    > popl %ebp


    >I could be nice to get some information on what %ebp means.


    http://c.ittoolbox.com/documents/popular-q-and-a/3062
    http://ocw.mit.edu/OcwWeb/Electrica...s/detail/pc_hardware_and_x86_-programming.htm

    --
    Is there any thing whereof it may be said, See, this is new? It hath
    been already of old time, which was before us. -- Ecclesiastes
     
    Walter Roberson, Nov 25, 2005
    #2
    1. Advertising

  3. >The option -S produces the corresponding assembly code for a .c file in the
    >file specified after -o. But where can I get a lsit of what the different
    >expresssions mean?


    If you don't know assembly language, getting assembly code is of
    questionable value.

    >I could be nice to get some information on what %ebp means.


    It's a machine register for a particular CPU. If you don't know
    about the architecture of the machine you're getting assembly code
    for, you're going to have trouble making any sense out of it.

    Gordon L. Burditt
     
    Gordon Burditt, Nov 25, 2005
    #3
  4. well, these are the CPU registers, you can refer 8086 CPU documentation
    for more details.
    and
    %ebp is extended base pointer,
    %esp is extended stack pointer
    %edx,%eax, these are register sets of CPU.
    movl,subl,popl these are the machine instruction specific particular
    CPU machine.
    in you code sub: is a SYMBOL or althernative in more easier we may call
    this as a function also.
    Infact,in your high level code sub is one function/routine but in
    Assemble code this is name as a routine or mostly SYMBOL.

    rgrds,
    Munish Nayyar
    emanshu "Innovative MInd"
    http://www.sarovar.org/projects/rtda
     
    emanshu, Munish Nayyar, Nov 28, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    432
  2. Kevin P. Fleming

    C99 structure initialization in gcc-2.95.3 vs gcc-3.3.1

    Kevin P. Fleming, Nov 6, 2003, in forum: C Programming
    Replies:
    2
    Views:
    646
    Kevin P. Fleming
    Nov 6, 2003
  3. Replies:
    5
    Views:
    362
    Nathan Addy
    Sep 17, 2005
  4. ashnin

    GCC 3.4.3 and GCC 4.1.2

    ashnin, Jul 7, 2008, in forum: C++
    Replies:
    1
    Views:
    525
    Michael DOUBEZ
    Jul 7, 2008
  5. kas
    Replies:
    1
    Views:
    319
    red floyd
    Apr 22, 2010
Loading...

Share This Page