toolchain : arm-none-eabi-gcc/g++ 7.3.1 (june 2018)
target : Cortex M4
C++ flags :
-D${CPU_NAME} -mcpu=${CPU} -mthumb -mfloat-abi=hard -mfpu=${FPU} \
-Wfatal-errors -Wall -Wno-unused-function \
-fdata-sections -ffunction-sections \
-fno-exceptions -fno-non-call-exceptions -fno-rtti -fno-use-cxa-atexit
Linker flags
--specs=nano.specs -Wl,--gc-sections -Wl,--strip-all --verbose \
-Wl,-Map=${OUTPUT_FILE_NAME}.map -T\"${LINKER_FILE}\"
Unused variables are optimized away thanks to -fdata-sections -ffunction-sections
and -Wl,--gc-sections
Why is an unused static class instance not optimized away ? Am I missing on option ?