News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How do you get MingW to output a .asm file

Started by hckr83, July 16, 2006, 01:07:59 AM

Previous topic - Next topic

hckr83

Hi how do you get the mingw included with codeblocks to output a .asm file?

thomas

For example:
1. do not use the -pipe switch
2. use the -S switch
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

hckr83

I tried -s(lowercase) and nothing happened and then I tried -S(uppercase) and now it gives a linker error on my object files

thomas

Quote from: hckr83 on July 16, 2006, 01:42:39 AM
I tried -s(lowercase) and nothing happened and then I tried -S(uppercase) and now it gives a linker error on my object files
Obviously :)

It nevertheless does exactly what you wanted.

D:\desktop>echo int main(){return 0;} > foo.c

D:\desktop>gcc -S foo.c -o foo.asm

D:\desktop>cat foo.asm
        .file   "foo.c"
        .def    ___main;        .scl    2;      .type   32;     .endef
        .text
.globl _main
        .def    _main;  .scl    2;      .type   32;     .endef
_main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        movl    $0, %eax
        addl    $15, %eax
        addl    $15, %eax
        shrl    $4, %eax
        sall    $4, %eax
        movl    %eax, -4(%ebp)
        movl    -4(%ebp), %eax
        call    __alloca
        call    ___main
        movl    $0, %eax
        leave
        ret

D:\desktop>
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

hckr83

#4
*checks .obj's

wow your right!
thanks for the help

edit:
lol bad thing is I still have no idea whats wrong with my code

mmkider

Quote from: hckr83 on July 16, 2006, 01:57:35 AM
*checks .obj's

wow your right!
thanks for the help

edit:
lol bad thing is I still have no idea whats wrong with my code
Now I Interest .asm for .c file.
I found this solution.
In your Interested file, you insert this follow command  in  this field of "Use custom command to build this file" of advanced tab.
           
Good luck.


       $compiler -S $file
       $compiler $options $includes -c $file -o $object