10-02-25 Lab 11
Compile C code to Assembly code:
gcc -O0 -S -o switch.s switch.c
- Note the
-Oflag- It is for compiler optimization levels
- 0, 1, 2, 3
- It is for compiler optimization levels
- Change the level of optimization to see how smart the compiler is
- When looking at loops, sometimes the compiler creates shortcuts to run things in parallel before actually running the loop for certain kind of values. It is very interesting.
Run assembly code:
gcc -nostartfiles -no-pie hello.s -o hello
./hello
-nostartfiles -no-pielets you use_startdirectly with your Linux syscalls.