Compiling
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
$ gcc code.c
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
$ gcc code.c
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
$ gcc code.c
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
$ ./a.out
Hello World!
Compilation process
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compiler
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compiler
Assembly code
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compiler
Assembly code
Assembler
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compiler
Assembly code
Assembler
Object code
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compiler
Assembly code
Assembler
Object code
Linker
Libraries
Compilation process
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
Compiler
Assembly code
Assembler
Object code
Linker
Libraries
Executable
Preprocessor
Preprocessor
#include <stdio.h>
void main() {
printf("Hello World!\n");
}
/*
actual code of
the <stdio.h> header
*/
void main() {
printf("Hello World!\n");
}
Compiler
Compiler
/*
actual code of
the <stdio.h> header
*/
void main() {
printf("Hello World!\n");
}
.file "code.c"
.text
.section .rodata
.LC0:
.string "Hello World!"
.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
leaq .LC0(%rip), %rdi
call puts@PLT
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
Assembler
Assembler
.file "code.c"
.text
.section .rodata
.LC0:
.string "Hello World!"
.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
leaq .LC0(%rip), %rdi
call puts@PLT
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
Linker
Linker
Libraries
Hello World!
Thank you for your attention.
Compiling
By Ventsislav Tashev
Compiling
- 663