-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Zephyr] Fix build issues with LTO (#34633)
* [Zephyr] Fix sys_heap malloc build with LTO Fix the build of Matter samples with sys_heap malloc enabled. The linker errors would occur because: 1. The realloc() function is not used outside the LTO- optimized code. 2. Thus, the LTO linker plugin would mark __wrap_realloc symbol as PREVAILING_DEF_IRONLY, which would enable the compiler to optimize away the function. 3. As a result, undefined references to realloc() could not be resolved by the linker. Mark malloc/calloc/realloc/free as externally visible. Signed-off-by: Damian Krolik <[email protected]> * [nrfconnect] Do not link libCHIPShell.a with --whole-archive libCHIPShell.a is already part of libCHIP.a but the former had to be linked additionally with --whole-archive flag to process the shell and init objects defined with SHELL_XXX and SYS_INIT Zephyr macros and, in turn, register Matter shell commands properly. This symbol duplication between the two libraries causes issues when building Matter with LTO, so replace the current approach with explicitly pulling in one symbol from MainLoopZephyr.cpp file. Signed-off-by: Damian Krolik <[email protected]> * [nrfconnect] Build all clusters app for nRF7002 with LTO The flash usage on this app/platform is close to the limit. Enable LTO to prevent from blocking the incoming PRs. Signed-off-by: Damian Krolik <[email protected]> --------- Signed-off-by: Damian Krolik <[email protected]>
- Loading branch information
1 parent
268e7ca
commit 9fc8c77
Showing
4 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters