Dynamic Linking and Relocations
In this article I'll explore the basic concepts associated with dynamic linking - PIC, dynamic relocation, GOT and PLT.
In this article I'll explore the basic concepts associated with dynamic linking - PIC, dynamic relocation, GOT and PLT.
In this article I'll explore the basic concepts associated with static linking - symbol resolution and relocation.
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 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.
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.
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.
Previously we've compiled our C demo program with gcc
command. It links dynamically by default.
In this article, I'll practice using GNU binutils to take a close look at the a.out
product.
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.
objdump - display information from object files.
objdump -d
: Display the assembler mnemonics for the machine instructions from the input file.
addr2line - convert addresses or symbol+offset into file names and line numbers.