아래와 같은 코드를 작성하였습니다.
test.c
이 코드를 어셈블리 코드로 보고 싶다면?
-S 옵션을 붙여 주면 됩니다.
그럼 아래와 같이 어셈블리 코드로 볼 수 있습니다.
참고로 전 어셈코드를 못 봅니다. 능력이 안됩니다.
test.c
{ printf("%d\n", i); return 0; } int main(int argc, char *argv[]) { int i; for(i=0;i<10;i++){ test(i); } return 0; } |
이 코드를 어셈블리 코드로 보고 싶다면?
-S 옵션을 붙여 주면 됩니다.
그럼 아래와 같이 어셈블리 코드로 볼 수 있습니다.
.file "test.c" .section .rodata .LC0: .string "%d\n" .text .globl test .type test, @function test: .LFB0: .cfi_startproc pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 movl %esp, %ebp .cfi_def_cfa_register 5 subl $24, %esp movl $.LC0, %eax movl 8(%ebp), %edx movl %edx, 4(%esp) movl %eax, (%esp) call printf movl $0, %eax leave .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc .LFE0: .size test, .-test .globl main .type main, @function main: .LFB1: .cfi_startproc pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 movl %esp, %ebp .cfi_def_cfa_register 5 andl $-16, %esp subl $32, %esp movl $0, 28(%esp) jmp .L3 .L4: movl 28(%esp), %eax movl %eax, (%esp) call test addl $1, 28(%esp) .L3: cmpl $9, 28(%esp) jle .L4 movl $0, %eax leave .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc .LFE1: .size main, .-main .ident "GCC: (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1" .section .note.GNU-stack,"",@progbits |
참고로 전 어셈코드를 못 봅니다. 능력이 안됩니다.
'development' 카테고리의 다른 글
[etc] 빌드 시스템 (0) | 2011.12.23 |
---|---|
[kernel] Thread 와 Kill (0) | 2011.11.26 |
[kernel] module_init(), module_exit() (0) | 2011.11.17 |
[kernel] obj-y ? obj-m ? obj-$(CONFIG_TEST) ? (1) | 2011.11.08 |
[kernel] 개발한 함수를 외부에 공개하는 법 (1) | 2011.11.08 |