mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
Use correct clang flag for size optimization
See https://clang.llvm.org/docs/CommandGuide/clang.html: >> Code Generation Options >> -Oz Like -Os (and thus -O2), but reduces code size further. Without -Oz enabled clang produced binaries that were too large.
This commit is contained in:
parent
a1e45ac2cc
commit
2d463ad18b
@ -16,7 +16,11 @@ endif()
|
|||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
|
|
||||||
if(CONFIG_COMPILER_OPTIMIZATION_SIZE)
|
if(CONFIG_COMPILER_OPTIMIZATION_SIZE)
|
||||||
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
list(APPEND compile_options "-Oz")
|
||||||
|
else()
|
||||||
list(APPEND compile_options "-Os")
|
list(APPEND compile_options "-Os")
|
||||||
|
endif()
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||||
list(APPEND compile_options "-freorder-blocks")
|
list(APPEND compile_options "-freorder-blocks")
|
||||||
endif()
|
endif()
|
||||||
@ -34,7 +38,11 @@ if(NOT BOOTLOADER_BUILD)
|
|||||||
else() # BOOTLOADER_BUILD
|
else() # BOOTLOADER_BUILD
|
||||||
|
|
||||||
if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE)
|
if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE)
|
||||||
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
list(APPEND compile_options "-Oz")
|
||||||
|
else()
|
||||||
list(APPEND compile_options "-Os")
|
list(APPEND compile_options "-Os")
|
||||||
|
endif()
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||||
list(APPEND compile_options "-freorder-blocks")
|
list(APPEND compile_options "-freorder-blocks")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user