mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 09:39:10 -04:00
Merge branch 'contrib/github_pr_12449' into 'master'
Use correct clang flag for size optimization (GitHub PR) Closes IDFGH-11295 See merge request espressif/esp-idf!33083
This commit is contained in:
commit
8fcc57b12f
@ -16,7 +16,11 @@ endif()
|
|||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
|
|
||||||
if(CONFIG_COMPILER_OPTIMIZATION_SIZE)
|
if(CONFIG_COMPILER_OPTIMIZATION_SIZE)
|
||||||
list(APPEND compile_options "-Os")
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
list(APPEND compile_options "-Oz")
|
||||||
|
else()
|
||||||
|
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)
|
||||||
list(APPEND compile_options "-Os")
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
list(APPEND compile_options "-Oz")
|
||||||
|
else()
|
||||||
|
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()
|
||||||
|
6
Kconfig
6
Kconfig
@ -323,8 +323,8 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
|||||||
help
|
help
|
||||||
This option sets compiler optimization level (gcc -O argument) for the app.
|
This option sets compiler optimization level (gcc -O argument) for the app.
|
||||||
|
|
||||||
- The "Debug" setting will add the -0g flag to CFLAGS.
|
- The "Debug" setting will add the -Og flag to CFLAGS.
|
||||||
- The "Size" setting will add the -0s flag to CFLAGS.
|
- The "Size" setting will add the -Os flag to CFLAGS (-Oz with Clang).
|
||||||
- The "Performance" setting will add the -O2 flag to CFLAGS.
|
- The "Performance" setting will add the -O2 flag to CFLAGS.
|
||||||
- The "None" setting will add the -O0 flag to CFLAGS.
|
- The "None" setting will add the -O0 flag to CFLAGS.
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
|||||||
config COMPILER_OPTIMIZATION_DEBUG
|
config COMPILER_OPTIMIZATION_DEBUG
|
||||||
bool "Debug (-Og)"
|
bool "Debug (-Og)"
|
||||||
config COMPILER_OPTIMIZATION_SIZE
|
config COMPILER_OPTIMIZATION_SIZE
|
||||||
bool "Optimize for size (-Os)"
|
bool "Optimize for size (-Os with GCC, -Oz with Clang)"
|
||||||
config COMPILER_OPTIMIZATION_PERF
|
config COMPILER_OPTIMIZATION_PERF
|
||||||
bool "Optimize for performance (-O2)"
|
bool "Optimize for performance (-O2)"
|
||||||
config COMPILER_OPTIMIZATION_NONE
|
config COMPILER_OPTIMIZATION_NONE
|
||||||
|
@ -20,14 +20,14 @@ menu "Bootloader config"
|
|||||||
This option sets compiler optimization level (gcc -O argument)
|
This option sets compiler optimization level (gcc -O argument)
|
||||||
for the bootloader.
|
for the bootloader.
|
||||||
|
|
||||||
- The default "Size" setting will add the -0s flag to CFLAGS.
|
- The default "Size" setting will add the -Os (-Oz with clang) flag to CFLAGS.
|
||||||
- The "Debug" setting will add the -Og flag to CFLAGS.
|
- The "Debug" setting will add the -Og flag to CFLAGS.
|
||||||
- The "Performance" setting will add the -O2 flag to CFLAGS.
|
- The "Performance" setting will add the -O2 flag to CFLAGS.
|
||||||
|
|
||||||
Note that custom optimization levels may be unsupported.
|
Note that custom optimization levels may be unsupported.
|
||||||
|
|
||||||
config BOOTLOADER_COMPILER_OPTIMIZATION_SIZE
|
config BOOTLOADER_COMPILER_OPTIMIZATION_SIZE
|
||||||
bool "Size (-Os)"
|
bool "Size (-Os with GCC, -Oz with Clang)"
|
||||||
config BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG
|
config BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG
|
||||||
bool "Debug (-Og)"
|
bool "Debug (-Og)"
|
||||||
config BOOTLOADER_COMPILER_OPTIMIZATION_PERF
|
config BOOTLOADER_COMPILER_OPTIMIZATION_PERF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user