Member-only story
Introduction to Reverse Engineering — Understanding Basic Compiled Code
This article will explore how to use basic tools like objdump to view the assembly instructions related to a compiled binary. To start with objdump, we will first create a simple C program to compile and disassemble. Write the following code into a file named start.c.
int main(void){
return 0;
}
After saving the file, compile it with gcc using the command gcc start.c -o start. With the file compiled, you can now disassemble the binary using objdump. To disassemble your binary, run the command objdump -d start. This command will output all of the assembly code related to your binary, as shown in the following figure.
You’ll notice that the output from objdump includes a large amount of assembly code. Most of the code shown sets up your program to start running. To find the code you wrote in start.c, you need to find the main function. Every function is labelled using the format [address] <function>. Following this pattern, you can find the main function by searching for main in the output. The following…