Thursday, December 25, 2025

C program compilation steps

 Preprocessor:

> gcc -E main.c -o main.i

Compilation:

> gcc -S main.i -o main.s

Assembler: Convert .S to obj file

>gcc -c main.s  -o main.o

>objdump -h main.o  // -> to view the .o file 

Linking:

gcc main.o -o main


> nm main.o // -> to view all the sections 

No comments:

Post a Comment