I wrote a small program c:
#include <stdio.h> int main() { char s[] = "Hello, world!"; printf("%s\n", s); return 0; }
which compiles (on my Linux machine):
.file "hello.c" .text .globl main .type main, @function main: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $1819043144, -32(%rbp) movl $1998597231, -28(%rbp) movl $1684828783, -24(%rbp) movw $33, -20(%rbp) leaq -32(%rbp), %rax movq %rax, %rdi call puts movl $0, %eax movq -8(%rbp), %rdx xorq %fs:40, %rdx je .L3 call __stack_chk_fail .L3: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2" .section .note.GNU-stack,"",@progbits
I donโt understand the assembly code, but I donโt see anything in the string message. So how does the executable know what to print?
source share