From 5358f5b94062e934878516be4fe3bb87d65bcb8d Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Tue, 3 Dec 2024 15:16:15 -0300 Subject: [PATCH] libm: Do not link the toolchain's libm unless explicitly selected Fix CMake-based build system to include the toolchain's libm only when `CONFIG_LIBM_TOOLCHAIN` is selected. Before this commit, if the user selected `CONFIG_LIBM_NEWLIB`, for instance, the build system would still link the toolchain's libm functions instead of the ones provided by newlib. PS: this commit applies the same changes previously introduced for the other architectures. --- arch/arm64/src/cmake/platform.cmake | 2 +- arch/xtensa/src/cmake/platform.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/src/cmake/platform.cmake b/arch/arm64/src/cmake/platform.cmake index 4d8304e2fc..a9439d5432 100644 --- a/arch/arm64/src/cmake/platform.cmake +++ b/arch/arm64/src/cmake/platform.cmake @@ -42,7 +42,7 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) -if(NOT CONFIG_LIBM) +if(CONFIG_LIBM_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libm.a diff --git a/arch/xtensa/src/cmake/platform.cmake b/arch/xtensa/src/cmake/platform.cmake index 95e1a538a2..f9991c71af 100644 --- a/arch/xtensa/src/cmake/platform.cmake +++ b/arch/xtensa/src/cmake/platform.cmake @@ -42,7 +42,7 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) -if(NOT CONFIG_LIBM) +if(CONFIG_LIBM_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libm.a