2️⃣Binary Analysis

4 Stages of Compilation

1. Preprocessing

#include<stdio.h>

#define FORMAT_STRING "%s"
#define MESSAGE "Hello, world!\n"

int main(int argc, char **agrv)
{ 
        printf(FORMAT_STRING, MESSAGE);
        return 0;
}
$ gcc -E -P <test.c>
  • -E: Preprocess only; do not compile, assemble or link.

2. Compilation

$ gcc -S -masm=intel test.c 

3. Assembly

$ gcc -c test.c
$ file test.o

Note: Relocatable means you are dealing with an object file and not with an executable file.

Linking

gcc <test.c>
file a.out

Last updated