gcc assembly output
Mar 15, 2012 at 7:03am UTC
hi
i am practicing reversing programs and i thought it would be helpful to view the assembly code of my own programs to learn about how they look in assembly. i used the -S flag with gcc compiler wich produces the assembly code of program. but the code doesn't look like those in debuggers.
it's something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
.file "interest.cpp"
.lcomm __ZStL8__ioinit,1,1
.text
.globl __Z9calculatefif
.def __Z9calculatefif; .scl 2; .type 32; .endef
__Z9calculatefif:
pushl %ebp
movl %esp, %ebp
subl $20, %esp
movl $0x00000000, %eax
movl %eax, -8(%ebp)
movl $0, -12(%ebp)
jmp L2
L3:
flds 16(%ebp)
fmuls 8(%ebp)
flds LC1
fdivrp %st, %st(1)
fstps -4(%ebp)
flds 16(%ebp)
fadds -4(%ebp)
fstps 16(%ebp)
flds -8(%ebp)
fadds -4(%ebp)
fstps -8(%ebp)
incl -12(%ebp)
what are these codes? are they ASM? the assembly code i see in debugger (ollydbg) is something like this:
1 2 3 4 5 6 7 8 9 10 11 12
PUSH EBP
MOV EBP,ESP
SUB ESP,18
MOV DWORD PTR SS:[ESP],1
CALL DWORD PTR DS:[<&msvcrt.__set_app_type>] CALL interest.00401020
NOP
LEA ESI,DWORD PTR DS:[ESI]
PUSH EBP
MOV EBP,ESP
PUSH EBX
SUB ESP,14
MOV EAX,DWORD PTR SS:[EBP+8]
is there any way to tell the compiler produce these kind of codes for my program?
thanks
Last edited on Mar 15, 2012 at 7:04am UTC
Mar 15, 2012 at 8:01pm UTC
ok i got it
it was the AT&T syntax i sould use -S -masm=intel to produce intel code
thanks anyway
Topic archived. No new replies allowed.