From 22c45c9234c12d5066e29c6f410d2d8151b43a74 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 2 Sep 2024 12:16:27 +0200 Subject: [PATCH] cmake: remove llvm runtime library selection from target_base.cmake The selection of the runtime library when using LLVM has already been done in llvm/target.cmake and passed to the toolchain_ld_base() function through the global TOOLCHAIN_LD_FLAGS setting. The only reason this haven't been noticed is because of CMake's built-in symbol de-duplication feature. Remove the redundant runtime library handling. Signed-off-by: Torsten Rasmussen --- cmake/linker/ld/target_base.cmake | 12 ------------ cmake/linker/lld/target_base.cmake | 10 ---------- 2 files changed, 22 deletions(-) diff --git a/cmake/linker/ld/target_base.cmake b/cmake/linker/ld/target_base.cmake index f70f5c26b68..8e7768476d4 100644 --- a/cmake/linker/ld/target_base.cmake +++ b/cmake/linker/ld/target_base.cmake @@ -28,18 +28,6 @@ macro(toolchain_ld_base) ) endif() - if (CONFIG_LLVM_USE_LD) - if(CONFIG_LIBGCC_RTLIB) - set(runtime_lib "libgcc") - elseif(CONFIG_COMPILER_RT_RTLIB) - set(runtime_lib "compiler_rt") - endif() - - zephyr_link_libraries( - --config ${ZEPHYR_BASE}/cmake/toolchain/llvm/clang_${runtime_lib}.cfg - ) - endif() - if(CONFIG_CPP AND (CMAKE_C_COMPILER_ID STREQUAL "Clang")) # GNU ld complains when used with llvm/clang: # error: section: init_array is not contiguous with other relro sections diff --git a/cmake/linker/lld/target_base.cmake b/cmake/linker/lld/target_base.cmake index 203322a9019..1342867f993 100644 --- a/cmake/linker/lld/target_base.cmake +++ b/cmake/linker/lld/target_base.cmake @@ -43,14 +43,4 @@ macro(toolchain_ld_base) -Wl,-z,norelro ) endif() - - if(CONFIG_LIBGCC_RTLIB) - set(runtime_lib "libgcc") - elseif(CONFIG_COMPILER_RT_RTLIB) - set(runtime_lib "compiler_rt") - endif() - - zephyr_link_libraries( - --config ${ZEPHYR_BASE}/cmake/toolchain/llvm/clang_${runtime_lib}.cfg - ) endmacro()