| Arquivo: teste.c |
| // ================ // Converter C/C++ => Assembly => teste.s // Comandos: // g++ -S teste.c // ================ // Criando um programa com um Assembly => C/C++ // Comandos: // g++ -g teste.s -o teste // ./teste // ================ #include <stdio.h> int main(int argc, char **argv){ char Texto[] = "Hello World"; printf("%s\n", Texto); return 0; } |
| Resultado: |
| .file "teste.c" .text .globl main .type main, @function main: .LFB0: .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 12(%ebp), %eax movl %eax, 12(%esp) movl %gs:20, %eax movl %eax, 28(%esp) xorl %eax, %eax movl $1819043144, 16(%esp) movl $1867980911, 20(%esp) movl $6581362, 24(%esp) leal 16(%esp), %eax movl %eax, (%esp) call puts movl $0, %eax movl 28(%esp), %edx xorl %gs:20, %edx je .L3 call __stack_chk_fail .L3: leave .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4" .section .note.GNU-stack,"",@progbits |