This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
x86 assembly output
- To: gcc-bugs at gcc dot gnu dot org
- Subject: x86 assembly output
- From: HOWARD LEW <mrhow at sfsu dot edu>
- Date: Fri, 29 Oct 1999 01:15:12 -0700 (PDT)
- cc: mrhow at sfsu dot edu
Does anyone know why the x86 assembly language output from g++ does not
conform to the standard Intel convention?
For example, compile the null C++ program, and the output is:
.file "void.cc"
gcc2_compiled.:
___gnu_compiled_cplusplus:
.text
.align 2
.globl _main
.type _main,@function
_main:
pushl %ebp
movl %esp,%ebp
call ___main
xorl %eax,%eax
jmp L1
.align 2,0x90
L1:
leave
ret
Lfe1:
.size _main,Lfe1-_main
The movl line above shows:
movl %esp,%ebp
when it should be:
movl %ebp,%esp
According to Intel Architecture Software Developer's Manual page 3-286,
the source register should be on the right, and the destination register
should be on the left. However, when the code is compiled, the correct
form (the latter one) is used. Borland C++ and MS Visual C++ both follow
the Intel convention.
Is this a bug or does g++ have its own convention?