Skip to content

2023#

REL ELF Walkthrough

Previously we've compiled our C demo program with gcc -c command.

gcc -c compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.

In this article, I'll practice using GNU binutils to take a close look at the 0701.o product.

GCC Compilation Stage

GCC is a collection of compilers.

The C compiler itself turns C code into an assembly code listing, and this is sent to the assembler to be converted into an object file and later linked into a target binary.

If you only want some of the stages of compilation, you can use -x (or filename suffixes) to tell gcc where to start, and one of the options -c, -S, or -E to say where gcc is to stop.

EXEC ELF Walkthrough

Previously we've compiled our C demo program with gcc -static command.

By passing a -static option, we demand GCC to change its default link policy from dynamic to static.

In this article, I'll practice using GNU binutils to take a close look at the b.out product.

GCC Compilation Quick Tour - static

Previously, we've taken a look at the basic compilation of C programs using GCC. It links dynamically by default.

In this article, we simply add a -static option to GCC to change its default link policy from dynamic to static.

We then go on to make a basic comparison of the processes of dynamic linking and static linking.

GCC Compilation Quick Tour - dynamic

The compilation is the process of converting the source code of the C language into machine code.

As C is a mid-level language, it needs a compiler to convert it into an executable code so that the program can be run on our machine.

In this article, let's do a hands-on practice to take a close look at the basic compilation of C program with GCC.