Skip to content

Conversation

@carlescufi
Copy link
Member

As described in this issue:
zephyrproject-rtos/sdk-ng#1038 -flto=auto fails on some (slower) Windows machines due to an issue with the Zephyr SDK's GCC toolchain for Windows.
In order to allow users to work around this issue, introduce a new CONFIG_LTO_SINGLE_THREADED option that switches to -flto=1, which enforces a single thread when processing LTO.

Copy link
Contributor

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this, but we need corresponding property names in the templates:
https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/compiler/compiler_flags_template.cmake
https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/linker/linker_flags_template.cmake

and it seems the existing optimization_lto and lto_arguments are also missing 🙁

@tejlmand
Copy link
Contributor

@RobinKastberg will you take a look at corresponding IAR flags to use ?
@evgeniy-paltsev will you take a look at corresponding MetaWare flags to use ?

so that this property is not empty for those toolchains 🙂

As described in this issue:
zephyrproject-rtos/sdk-ng#1038
`-flto=auto` fails on some (slower) Windows machines due to an issue with
the Zephyr SDK's GCC toolchain for Windows.
In order to allow users to work around this issue, introduce a new
CONFIG_LTO_SINGLE_THREADED option that switches to `-flto=1`, which
enforces a single thread when processing LTO.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add variants of existing tests to cover this new Kconfig option.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
@carlescufi
Copy link
Member Author

Thanks for fixing this, but we need corresponding property names in the templates: https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/compiler/compiler_flags_template.cmake https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/linker/linker_flags_template.cmake

and it seems the existing optimization_lto and lto_arguments are also missing 🙁

Thanks, done @tejlmand.

@carlescufi carlescufi requested a review from tejlmand November 26, 2025 16:08
@carlescufi
Copy link
Member Author

@RobinKastberg will you take a look at corresponding IAR flags to use ?
@evgeniy-paltsev will you take a look at corresponding MetaWare flags to use ?

@tejlmand I don't think LTO was supported on these toolchains to start with, so this new single-threaded option is not applicable to those until they actually support LTO itself?

@sonarqubecloud
Copy link

@RobinKastberg
Copy link
Contributor

@RobinKastberg will you take a look at corresponding IAR flags to use ?
@evgeniy-paltsev will you take a look at corresponding MetaWare flags to use ?

@tejlmand I don't think LTO was supported on these toolchains to start with, so this new single-threaded option is not applicable to those until they actually support LTO itself?

Yeah... This is 100% the way for us. But I appreciate being asked anyways! You can leave it empty

@tejlmand
Copy link
Contributor

tejlmand commented Nov 27, 2025

@tejlmand I don't think LTO was supported on these toolchains to start with, so this new single-threaded option is not applicable to those until they actually support LTO itself?

Seems like it.
@carlescufi note, the comment for @RobinKastberg and @evgeniy-paltsev is not blocking for this PR but was for them to be aware and follow-up with similar work for their toolchains (hence the reason the comment was made independent of the request-for-changes review comment 🙂 )

@fabiobaltieri fabiobaltieri merged commit 84a85ed into zephyrproject-rtos:main Nov 28, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Build System area: Kconfig area: Kernel area: Tests Issues related to a particular existing or missing test area: Toolchains Toolchains

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants