SPO 600 - Lab 2
In lab 2, I will be looking at how different compiler options would affect the executable. I will be using gcc in this lab, and this lab is running on x86_64 architecture. First, let's start with a simple C hello world program: #include <stdio.h> int main () { printf( "Hello World! \n " ); } Next, I'll compile it with the option: gcc -g -O0 -fno-builtin -o hello hello.c (Note: -g enables the debugging option, -O0 stands for no optimization, and -fno-builtin stands for don't use built in function optimizations ) If I run the executable by entering ./hello , it should give me: Hello World! Using objdump --source hello, I can find the <main> section contains the code I wrote: And using objdump -s hello, I can also find where the string is stored (It's stored in .rodata, or read-only data segment): Right now I'll make a couple changes to see how the option would affect the executable. 1. Add the -static opti...