AR# 24352


11.1 EDK - How can I set compiler optimization for building BSP?


I am trying to use compiler optimization flags for building the BSP. I set the value for EXTRA_COMPILER_FLAGS in Software Platform Settings to "-O0 -g." However, I still receive the "-O2" during BSP build:

"Configuring make for target include using:

make -s include "COMPILER=mb-g++" "ARCHIVER=mb-ar"

"COMPILER_FLAGS=-mno-xl-soft-mul -mxl-barrel-shift -mhard-float -mno-xl-soft-div


Configuring make for target libs using:

make -s libs "COMPILER=mb-g++" "ARCHIVER=mb-ar"

"COMPILER_FLAGS=-mno-xl-soft-mul -mxl-barrel-shift -mhard-float -mno-xl-soft-div



COMPILER_FLAGS is automatically populated with the correct set of values by LibGen. This field is not editable in the Software Platform Settings dialog box. The EXTRA_COMPILER_FLAGS option is typically used for user-defined flags. Even though -O2 and -O0 are present in the compile line, GCC picks up the last flag to compile and, consequently, EXTRA_COMPILER_FLAGS always override the -O2 COMPILER_FLAGS switch if the -O0 switch is present.

AR# 24352
Date 12/15/2012
Status Active
Type General Article
People Also Viewed