diff options
author | Keith Short <keithshort@chromium.org> | 2021-04-01 17:17:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-05 23:11:14 +0000 |
commit | 9edbb53dc2eb27b05c36098c522232d31fef4202 (patch) | |
tree | 175a96f2fe092b0f8bf44cd24594e7bbe0d63d3b | |
parent | 0e85e435cfdc234b5b6b7df1c88e63ee1cb8752e (diff) | |
download | chrome-ec-9edbb53dc2eb27b05c36098c522232d31fef4202.tar.gz |
zephyr: Disable LTO for zephyr toolchain
If both CONFIG_LTO and CONFIG_FPU are enabled, the Zephyr toolchain
generates linker errors. Disable LTO to unblock non-chroot builds and
Gitlab builds.
BUG=b:184302085
BRANCH=none
TEST=Build zephyr EC for volteer with coreboot toolchain, verify LTO is
enabled
TEST=Build zephyr EC for volteer with zephyr toolchain, verify LTO is
disabled
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Ib8e99df0b96c3a1579bdcb1f98b023bf13f0be8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801251
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | zephyr/CMakeLists.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 005c9b8416..01f06b7547 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -61,7 +61,14 @@ if(DEFINED CONFIG_PLATFORM_EC) # TODO: Enable LTO for all sources when Zephyr supports it. # See https://github.com/zephyrproject-rtos/zephyr/issues/2112 if (DEFINED CONFIG_LTO) - set_property(TARGET app PROPERTY INTERPROCEDURAL_OPTIMIZATION True) + # The Zephyr toolchain generates linker errors if both CONFIG_LTO and + # CONFIG_FPU are used. See b/184302085. + if(("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr") AND + (DEFINED CONFIG_FPU)) + message(STATUS "Zephyr toolchain and CONFIG_FPU detected: disabling LTO") + else() + set_property(TARGET app PROPERTY INTERPROCEDURAL_OPTIMIZATION True) + endif() endif() endif() |