Assembly code of a C code
We usually use gcc to compile c codes. However, to see assembly code of the C code
that we write, we should add "-S" option while compiling the code.
gcc -S -c code.c
The command above compiles code.c as it generates code.s file which includes assembly code.
Example C code and generated Assembly Code.
code.c
#include <stdio.h>
int main(int argc, char *argv[])
{
return 0;
}
code.s
.file "code.c"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
movl $0, %eax
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (GNU) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)"
.section .note.GNU-stack,"",@progbits
- 0 Comment
- Halil Demirezen
- 29 Jul 2008, 10:29
-
You must be login first or sign-up for an account to post comments.
USERBOX
CATEGORIES
MOST READ TODAY
LAST ADDED
- Using iPhone internet sharing over bluetooth under Linux
- Using USB sound card with amarok
- Multi-conditional search and replace (clearing a ftp trojan script example)
- Disabling ipv6 functionality
- How to convert a mp3 file
- How to choose the fastest Debian mirror
- Disabling reverse dns lookups in ssh
- Rewriting destination ip address
- Deleting A File By It's Inode Value
- Learning which libraries are used for a binary
