31.2 Compiler Optimizations

When optimization is enabled, the code being debugged is different than the code debugged without optimization. For example, some instructions might be more efficient for the processor when optimization is turned on but they may introduce timing issues.

TIP: Disable compiler optimizations during the development and debugging phases.

The example below shows the [BuildOptions] section that may be added to the DSC example from Chapter 30 to disable compiler optimizations for all compilers.

Example 265-EDK II Package DSC File with Optimizations Disabled

GCC:*_*_*_CC_FLAGS = -O0
INTEL:*_*_*_CC_FLAGS = /Od
MSFT:*_*_*_CC_FLAGS = /Od