GNU Assembler works on Linux, not on Windows
<p>I have this question on why the following GNU Assemlber(GAS) Code works on Ubuntu 16.04 , but when i run the same command it dosent work on windows(i will show error at end):</p>

<p>functions.S:</p>

<pre><code>#
#           POWER FUNCTION
#           ---------------
#EAX - BASE
#EDI - EXP
# 2 * 2 * 2 * 2 * 2 = 2^5

.section .data


.section .text

    .globl _start

        _start:
                movl $1, %ebx
                pushl $2
                pushl $5
                call _powr
                jmp _eof

                .type _powr,@function
                _powr:
                    pushl %ebp
                    movl  %esp, %ebp
                    subl  $4, %esp
                    movl 8(%ebp),%edi
                    movl 12(%ebp) , %eax
                    call _powr_loop
                    movl %ebp, %esp
                    popl %ebp
                    ret
                .type _powr_loop,@function
                _powr_loop:
                    cmp $0,%edi
                    je _return
                    #ebx = ebx * eax
                    imull %eax,%ebx
                    decl %edi
                    jmp _powr_loop

                _return:
                    ret
                _eof:
                     mov $1, %eax
                     int $0x80
</code></pre>

<p>Makefile:</p>

<pre><code>all:
    gcc -m32 functions.S -g -o exe -nostdlib
get_ebx:
    echo $?
</code></pre>

<p>. Well this runs perfectly fine on Linux , and when i do echo $? , it gives me the desired output 32 . BUT When i compile it on Windows i get this:</p>

<pre><code>C:/BlahBLah/BlahBlah&gt;gcc -m32 functions.S -g -o exe -nostdlib
functions.S: Assembler messages:
functions.S:22: Warning: .type pseudo-op used outside of .def/.endef ignored.
functions.S:22: Error: junk at end of line, first unrecognized character is `_'
functions.S:35: Warning: .type pseudo-op used outside of .def/.endef ignored.
functions.S:35: Error: junk at end of line, first unrecognized character is `p'
</code></pre>

<p>And also, what is the echo$? For Windows? Help would be appreciated!</p>

<h2>EDIT</h2>

<p>WinMain:</p>

<pre><code>#
#           POWER FUNCTION
#           ---------------
#EAX - BASE
#EDI - EXP
# 2 * 2 * 2 * 2 * 2 = 2^5

.section .data


.section .text

    .globl _WinMain 

        _WinMain:
                movl $1, %ebx
                pushl $2
                pushl $5
                call _powr
                jmp _eof

                _powr:
                    pushl %ebp
                    movl  %esp, %ebp
                    subl  $4, %esp
                    movl 8(%ebp),%edi
                    movl 12(%ebp) , %eax
                    call powr_loop
                    movl %ebp, %esp
                    popl %ebp
                    ret;


                powr_loop:
                    cmp $0,%edi
                    je _return
                    #ebx = ebx * eax
                    imull %eax,%ebx
                    decl %edi
                    jmp powr_loop

                _return:
                    ret
                _eof:
                    call _exit
</code></pre>