This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new b64fb09e6c cmake:bugfix fix CMake LTO build block
b64fb09e6c is described below
commit b64fb09e6c688fcb94877048e99dbc2173d24c3b
Author: xuxin19 <[email protected]>
AuthorDate: Tue Jul 16 15:50:13 2024 +0800
cmake:bugfix fix CMake LTO build block
it was wrong in https://github.com/apache/nuttx/pull/12423/files#r1618852245
EXTRA_FLAGS is useful in LTO for pass option tu lto linker
Signed-off-by: xuxin19 <[email protected]>
---
CMakeLists.txt | 4 ++--
libs/libc/assert/CMakeLists.txt | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2effa4c91..5d960036f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -642,8 +642,8 @@ if(NOT CONFIG_ARCH_SIM)
# TODO: nostart/nodefault not applicable to nuttx toolchain
target_link_libraries(
- nuttx PRIVATE -T${ldscript} -Wl,--start-group ${nuttx_libs}
- ${nuttx_extra_libs} -Wl,--end-group)
+ nuttx PRIVATE ${NUTTX_EXTRA_FLAGS} -T${ldscript} -Wl,--start-group
+ ${nuttx_libs} ${nuttx_extra_libs} -Wl,--end-group)
# generate binary outputs in different formats (.bin, .hex, etc)
nuttx_generate_outputs(nuttx)
diff --git a/libs/libc/assert/CMakeLists.txt b/libs/libc/assert/CMakeLists.txt
index 09c4b50b22..e2b2f9a034 100644
--- a/libs/libc/assert/CMakeLists.txt
+++ b/libs/libc/assert/CMakeLists.txt
@@ -24,7 +24,10 @@ if(CONFIG_STACK_CANARIES)
list(APPEND SRCS lib_stackchk.c)
endif()
-set_source_files_properties(lib_assert.c PROPERTIES COMPILE_FLAGS -fno-lto)
-set_source_files_properties(lib_stackchk.c PROPERTIES COMPILE_FLAGS -fno-lto)
-
+if(CONFIG_ARCH_TOOLCHAIN_GNU AND NOT CONFIG_LTO_NONE)
+ set_source_files_properties(lib_assert.c DIRECTORY .. PROPERTIES
COMPILE_FLAGS
+ -fno-lto)
+ set_source_files_properties(lib_stackchk.c DIRECTORY ..
+ PROPERTIES COMPILE_FLAGS -fno-lto)
+endif()
target_sources(c PRIVATE ${SRCS})